ing
This commit is contained in:
parent
fe3407551c
commit
ec8c352d5f
|
@ -82,19 +82,9 @@ func (c *Client) logHeader() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Send(method string, params ...interface{}) error {
|
func (c *Client) Send(method string, params ...interface{}) error {
|
||||||
rs, err := c.internalSend(false, nil, method, params...)
|
_, err := c.internalSend(false, nil, method, params...)
|
||||||
if nil != err {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer releaseRequestState(rs)
|
return err
|
||||||
select {
|
|
||||||
case <-rs.doneChan:
|
|
||||||
if nil != rs.clientError {
|
|
||||||
return rs.clientError
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Call(result interface{}, method string, params ...interface{}) error {
|
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.method = method
|
||||||
rs.params = params
|
rs.params = params
|
||||||
rs.doneChan = make(chan *requestState, 1)
|
|
||||||
if hasResponse {
|
if hasResponse {
|
||||||
rs.id = c.getRequestID()
|
rs.id = c.getRequestID()
|
||||||
rs.result = result
|
rs.result = result
|
||||||
|
rs.doneChan = make(chan *requestState, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user