This commit is contained in:
crusader 2018-04-28 23:58:03 +09:00
parent fe3407551c
commit ec8c352d5f

View File

@ -82,19 +82,9 @@ func (c *Client) logHeader() string {
}
func (c *Client) Send(method string, params ...interface{}) error {
rs, err := c.internalSend(false, nil, method, params...)
if nil != err {
return err
}
_, err := c.internalSend(false, nil, method, params...)
defer releaseRequestState(rs)
select {
case <-rs.doneChan:
if nil != rs.clientError {
return rs.clientError
}
}
return nil
return err
}
func (c *Client) Call(result interface{}, method string, params ...interface{}) error {
@ -133,10 +123,10 @@ func (c *Client) internalSend(hasResponse bool, result interface{}, method strin
rs.method = method
rs.params = params
rs.doneChan = make(chan *requestState, 1)
if hasResponse {
rs.id = c.getRequestID()
rs.result = result
rs.doneChan = make(chan *requestState, 1)
}
select {