Avoid a rare panic when a connection is dropped (#6566)
This commit is contained in:
parent
e831e1b0dd
commit
a1b3246d0d
|
|
@ -621,8 +621,13 @@ impl Service<Request> for Client {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
// The receiver end of the oneshot is itself a future.
|
// The receiver end of the oneshot is itself a future.
|
||||||
rx.map(|oneshot_recv_result| {
|
rx.map(|oneshot_recv_result| {
|
||||||
oneshot_recv_result
|
// The ClientRequest oneshot sender should not be dropped before sending a
|
||||||
.expect("ClientRequest oneshot sender must not be dropped before send")
|
// response. But sometimes that happens during process or connection shutdown.
|
||||||
|
// So we just return a generic error here.
|
||||||
|
match oneshot_recv_result {
|
||||||
|
Ok(result) => result,
|
||||||
|
Err(oneshot::Canceled) => Err(PeerError::ConnectionDropped.into()),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue