This commit is contained in:
crusader 2018-06-01 17:03:44 +09:00
parent 1092f7a7ae
commit dcc3af0723
3 changed files with 10 additions and 1 deletions

View File

@ -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 {

View File

@ -7,6 +7,7 @@ type ClientCodec interface {
}
type ClientResponseCodec interface {
IsNotification() bool
Notification() (ClientNotificationCodec, error)
Result(result interface{}) error
Error() *Error

View File

@ -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")