From 74d68de28fb5c9b830ff47444f224a65e4790bf7 Mon Sep 17 00:00:00 2001 From: crusader Date: Sun, 29 Apr 2018 19:26:17 +0900 Subject: [PATCH] ing --- client/client.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/client/client.go b/client/client.go index d2c6053..a334273 100644 --- a/client/client.go +++ b/client/client.go @@ -110,8 +110,11 @@ func (c *Client) CallTimeout(timeout time.Duration, result interface{}, method s select { case <-rs.doneChan: + if nil != rs.clientError { + return rs.clientError + } result = rs.result - return rs.clientError + return nil case <-t.C: rs.cancel() return newError(method, params, fmt.Errorf("%s Timeout", c.logHeader())) @@ -304,10 +307,13 @@ func (c *Client) handleResponse(resCodec protocol.ClientResponseCodec) { return } rs := _rs.(*requestState) - rs.setError(resCodec.Error()) - err := resCodec.Result(rs.result) - if nil != err { - rs.setError(err) + if nil != resCodec.Error() { + rs.setError(resCodec.Error()) + } else { + err := resCodec.Result(rs.result) + if nil != err { + rs.setError(err) + } } rs.done()