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:
result = rs.result if nil != rs.clientError {
return rs.clientError return rs.clientError
}
result = rs.result
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,11 +307,14 @@ func (c *Client) handleResponse(resCodec protocol.ClientResponseCodec) {
return return
} }
rs := _rs.(*requestState) rs := _rs.(*requestState)
if nil != resCodec.Error() {
rs.setError(resCodec.Error()) rs.setError(resCodec.Error())
} else {
err := resCodec.Result(rs.result) err := resCodec.Result(rs.result)
if nil != err { if nil != err {
rs.setError(err) rs.setError(err)
} }
}
rs.done() rs.done()
} }