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 {
case <-rs.doneChan:
result = rs.result
if nil != rs.clientError {
return rs.clientError
}
result = rs.result
return nil
case <-t.C:
rs.cancel()
return newError(method, params, fmt.Errorf("%s Timeout", c.logHeader()))
@ -304,11 +307,14 @@ func (c *Client) handleResponse(resCodec protocol.ClientResponseCodec) {
return
}
rs := _rs.(*requestState)
if nil != resCodec.Error() {
rs.setError(resCodec.Error())
} else {
err := resCodec.Result(rs.result)
if nil != err {
rs.setError(err)
}
}
rs.done()
}