Add client side context.Done support

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2018-08-28 10:54:57 -04:00
parent 94dde38880
commit d77f111e2e

View File

@ -110,12 +110,16 @@ func (c *Client) dispatch(ctx context.Context, req *Request, resp *Response) err
}
select {
case <-ctx.Done():
return ctx.Err()
case c.calls <- call:
case <-c.done:
return c.err
}
select {
case <-ctx.Done():
return ctx.Err()
case err := <-errs:
return filterCloseErr(err)
case <-c.done: