From dcc3af07239b3f6fcbae3529bcb52c522b02053d Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 1 Jun 2018 17:03:44 +0900 Subject: [PATCH] ing --- client/client.go | 3 ++- protocol/client_codec.go | 1 + protocol/json/client_response.go | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index fae49d3..aade5e8 100644 --- a/client/client.go +++ b/client/client.go @@ -279,7 +279,8 @@ LOOP: logging.Logger().Debug(err) continue LOOP } - if nil == resCodec.ID() { + + if resCodec.IsNotification() { // notification notiCodec, err := resCodec.Notification() if nil != err { diff --git a/protocol/client_codec.go b/protocol/client_codec.go index 92d9fd1..bb417cc 100644 --- a/protocol/client_codec.go +++ b/protocol/client_codec.go @@ -7,6 +7,7 @@ type ClientCodec interface { } type ClientResponseCodec interface { + IsNotification() bool Notification() (ClientNotificationCodec, error) Result(result interface{}) error Error() *Error diff --git a/protocol/json/client_response.go b/protocol/json/client_response.go index 611c917..3feb036 100644 --- a/protocol/json/client_response.go +++ b/protocol/json/client_response.go @@ -42,6 +42,13 @@ func (crc *ClientResponseCodec) Error() *protocol.Error { return crc.res.Error } +func (crc *ClientResponseCodec) IsNotification() bool { + if nil == crc.res.ID && nil != crc.res.Result { + return true + } + return false +} + func (crc *ClientResponseCodec) Notification() (protocol.ClientNotificationCodec, error) { if nil != crc.res.ID || nil == crc.res.Result { return nil, fmt.Errorf("This is not notification")