From 99e3263594de05b60efe586fc28949ce42d33622 Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 23 Nov 2017 18:18:37 +0900 Subject: [PATCH] ing --- protocol/json/client.go | 19 +++++++++++++++---- protocol/json/client_notify.go | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/protocol/json/client.go b/protocol/json/client.go index 955656d..0a0adea 100644 --- a/protocol/json/client.go +++ b/protocol/json/client.go @@ -110,17 +110,28 @@ func newClientCodecResponseOrNotify(r io.Reader, encoder encode.Encoder) (protoc ccrn := retainClientCodecResponseOrNotify() - if res, err := newClientCodecResponse(raw); nil != err { - notify, err := newClientCodecNotify(raw) + if notify, err := newClientCodecNotify(raw); nil != err { + res, err := newClientCodecResponse(raw) if nil != err { releaseClientCodecResponseOrNotify(ccrn) return nil, fmt.Errorf("Is not response or notification [%v]", raw) } - ccrn.notify = notify - } else { ccrn.response = res + } else { + ccrn.notify = notify } + // if res, err := newClientCodecResponse(raw); nil != err { + // notify, err := newClientCodecNotify(raw) + // if nil != err { + // releaseClientCodecResponseOrNotify(ccrn) + // return nil, fmt.Errorf("Is not response or notification [%v]", raw) + // } + // ccrn.notify = notify + // } else { + // ccrn.response = res + // } + return ccrn, nil } diff --git a/protocol/json/client_notify.go b/protocol/json/client_notify.go index a7a057d..783227b 100644 --- a/protocol/json/client_notify.go +++ b/protocol/json/client_notify.go @@ -23,7 +23,7 @@ func newClientCodecNotify(raw json.RawMessage) (protocol.ClientCodecNotify, erro } if "" == ccn.notify.Method { releaseClientCodecNotify(ccn) - return nil, fmt.Errorf("This is not ClientNotify") + return nil, fmt.Errorf("This is not Client Notify") } if ccn.notify.Version != Version {