This commit is contained in:
crusader 2018-04-29 19:26:17 +09:00
parent 318a547d8b
commit 74d68de28f

View File

@ -110,8 +110,11 @@ func (c *Client) CallTimeout(timeout time.Duration, result interface{}, method s
select { select {
case <-rs.doneChan: case <-rs.doneChan:
if nil != rs.clientError {
return rs.clientError
}
result = rs.result result = rs.result
return rs.clientError return nil
case <-t.C: case <-t.C:
rs.cancel() rs.cancel()
return newError(method, params, fmt.Errorf("%s Timeout", c.logHeader())) return newError(method, params, fmt.Errorf("%s Timeout", c.logHeader()))
@ -304,10 +307,13 @@ func (c *Client) handleResponse(resCodec protocol.ClientResponseCodec) {
return return
} }
rs := _rs.(*requestState) rs := _rs.(*requestState)
rs.setError(resCodec.Error()) if nil != resCodec.Error() {
err := resCodec.Result(rs.result) rs.setError(resCodec.Error())
if nil != err { } else {
rs.setError(err) err := resCodec.Result(rs.result)
if nil != err {
rs.setError(err)
}
} }
rs.done() rs.done()