Skip to content

Commit

Permalink
Drain pending requests before completing RequestDispatch future. (#423)
Browse files Browse the repository at this point in the history
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
tikue authored Feb 3, 2024
1 parent 9ed8696 commit d579f1c
Show file tree
Hide file tree
Showing 3 changed files with 312 additions and 73 deletions.
Loading

0 comments on commit d579f1c

Please sign in to comment.