Revert "Only reject pending client requests when the peer has errored"
This reverts commit e06705ed81
.
This commit is contained in:
parent
663ed6c842
commit
359015b2be
|
@ -345,7 +345,7 @@ impl State {
|
||||||
}
|
}
|
||||||
Either::Right((None, _)) => {
|
Either::Right((None, _)) => {
|
||||||
trace!("client_rx closed, ending connection");
|
trace!("client_rx closed, ending connection");
|
||||||
Transition::ExitClient
|
Transition::Exit(PeerError::ConnectionDropped.into())
|
||||||
}
|
}
|
||||||
Either::Right((Some(req), _)) => {
|
Either::Right((Some(req), _)) => {
|
||||||
if req.tx.is_canceled() {
|
if req.tx.is_canceled() {
|
||||||
|
@ -439,12 +439,9 @@ enum Transition {
|
||||||
tx: MustUseOneshotSender<Result<Response, SharedPeerError>>,
|
tx: MustUseOneshotSender<Result<Response, SharedPeerError>>,
|
||||||
span: tracing::Span,
|
span: tracing::Span,
|
||||||
},
|
},
|
||||||
/// Exiting because the client was closed or dropped, and there are
|
// Exiting while no client response is expected
|
||||||
/// no more client requests.
|
|
||||||
ExitClient,
|
|
||||||
/// Exiting while awaiting further client requests
|
|
||||||
Exit(SharedPeerError),
|
Exit(SharedPeerError),
|
||||||
/// Exiting while processing a peer response to a client request
|
// Exiting while processing a client response
|
||||||
ExitResponse {
|
ExitResponse {
|
||||||
tx: MustUseOneshotSender<Result<Response, SharedPeerError>>,
|
tx: MustUseOneshotSender<Result<Response, SharedPeerError>>,
|
||||||
e: SharedPeerError,
|
e: SharedPeerError,
|
||||||
|
@ -452,7 +449,7 @@ enum Transition {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<Transition> for State {
|
impl TryFrom<Transition> for State {
|
||||||
type Error = Option<SharedPeerError>;
|
type Error = SharedPeerError;
|
||||||
|
|
||||||
fn try_from(trans: Transition) -> Result<Self, Self::Error> {
|
fn try_from(trans: Transition) -> Result<Self, Self::Error> {
|
||||||
match trans {
|
match trans {
|
||||||
|
@ -460,11 +457,10 @@ impl TryFrom<Transition> for State {
|
||||||
Transition::AwaitResponse { handler, tx, span } => {
|
Transition::AwaitResponse { handler, tx, span } => {
|
||||||
Ok(State::AwaitingResponse { handler, tx, span })
|
Ok(State::AwaitingResponse { handler, tx, span })
|
||||||
}
|
}
|
||||||
Transition::ExitClient => Err(None),
|
Transition::Exit(e) => Err(e),
|
||||||
Transition::Exit(e) => Err(Some(e)),
|
|
||||||
Transition::ExitResponse { tx, e } => {
|
Transition::ExitResponse { tx, e } => {
|
||||||
let _ = tx.send(Err(e.clone()));
|
let _ = tx.send(Err(e.clone()));
|
||||||
Err(Some(e))
|
Err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,20 +525,16 @@ where
|
||||||
|
|
||||||
self.state = match transition.try_into() {
|
self.state = match transition.try_into() {
|
||||||
Ok(state) => Some(state),
|
Ok(state) => Some(state),
|
||||||
Err(None) => {
|
Err(e) => {
|
||||||
trace!("client_rx dropped: no pending client requests");
|
// while let Some(InProgressClientRequest { tx, span, .. }) =
|
||||||
return;
|
// self.client_rx.next().await
|
||||||
}
|
// {
|
||||||
Err(Some(e)) => {
|
// trace!(
|
||||||
while let Some(InProgressClientRequest { tx, span, .. }) =
|
// parent: &span,
|
||||||
self.client_rx.next().await
|
// "sending an error response to a pending request on a failed connection"
|
||||||
{
|
// );
|
||||||
trace!(
|
// let _ = tx.send(Err(e.clone()));
|
||||||
parent: &span,
|
// }
|
||||||
"sending an error response to a pending client request on a failed connection"
|
|
||||||
);
|
|
||||||
let _ = tx.send(Err(e.clone()));
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@ pub enum PeerError {
|
||||||
/// The remote peer closed the connection.
|
/// The remote peer closed the connection.
|
||||||
#[error("Peer closed connection")]
|
#[error("Peer closed connection")]
|
||||||
ConnectionClosed,
|
ConnectionClosed,
|
||||||
|
/// The local client closed the connection.
|
||||||
|
#[error("Internal client dropped connection")]
|
||||||
|
ConnectionDropped,
|
||||||
/// The remote peer did not respond to a [`peer::Client`] request in time.
|
/// The remote peer did not respond to a [`peer::Client`] request in time.
|
||||||
#[error("Client request timed out")]
|
#[error("Client request timed out")]
|
||||||
ClientRequestTimeout,
|
ClientRequestTimeout,
|
||||||
|
|
Loading…
Reference in New Issue