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(()) => {
|
||||
// The receiver end of the oneshot is itself a future.
|
||||
rx.map(|oneshot_recv_result| {
|
||||
oneshot_recv_result
|
||||
.expect("ClientRequest oneshot sender must not be dropped before send")
|
||||
// The ClientRequest oneshot sender should not be dropped before sending a
|
||||
// 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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue