Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drain pending requests before completing RequestDispatch future. (#423)
It is possible for the sending of a request to race with the dropping of RequestDispatch: a client could send a request, then the dispatch could be dropped before processing the request. If that happens, the client will never receive a shutdown notice. To fix this, the request dispatch must first close the pending requests channel, then drain all remaining requests from the channel, and for each request, complete it with an error. A few (hopefully minor) breaking changes were made: - All ChannelError source errors are now wrapped in Arcs, so that the errors can be cloned and sent to all pending requests. - RpcError::Receive was renamed to RpcError::Transport to accommodate the range of errors that can now be received by the client. Its source error is now a ChannelError. - RpcError::Send's source error is now the transport error rather than ChannelError::Write(Transport::Error), because ChannelError::Write wasn't adding any additional information.
- Loading branch information