rpc: don't exceed context deadline while waiting for send lock

This commit is contained in:
Felix Lange 2016-08-04 02:10:44 +02:00
parent 3e3a79ea13
commit 464660651d

View File

@ -398,6 +398,10 @@ func (c *Client) send(ctx context.Context, op *requestOp, msg interface{}) error
err := c.write(ctx, msg) err := c.write(ctx, msg)
c.sendDone <- err c.sendDone <- err
return err return err
case <-ctx.Done():
// This can happen if the client is overloaded or unable to keep up with
// subscription notifications.
return ctx.Err()
case <-c.didQuit: case <-c.didQuit:
return ErrClientQuit return ErrClientQuit
} }