mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 16:17:59 +00:00
network: Detect early that NotificationOutSubstream was closed by the remote (#13396)
This commit is contained in:
@@ -782,6 +782,9 @@ impl ConnectionHandler for NotifsHandler {
|
||||
// performed before the code paths that can produce `Ready` (with some rare exceptions).
|
||||
// Importantly, however, the flush is performed *after* notifications are queued with
|
||||
// `Sink::start_send`.
|
||||
// Note that we must call `poll_flush` on all substreams and not only on those we
|
||||
// have called `Sink::start_send` on, because `NotificationsOutSubstream::poll_flush`
|
||||
// also reports the substream termination (even if no data was written into it).
|
||||
for protocol_index in 0..self.protocols.len() {
|
||||
match &mut self.protocols[protocol_index].state {
|
||||
State::Open { out_substream: out_substream @ Some(_), .. } => {
|
||||
@@ -824,7 +827,7 @@ impl ConnectionHandler for NotifsHandler {
|
||||
State::OpenDesiredByRemote { in_substream, pending_opening } =>
|
||||
match NotificationsInSubstream::poll_process(Pin::new(in_substream), cx) {
|
||||
Poll::Pending => {},
|
||||
Poll::Ready(Ok(void)) => match void {},
|
||||
Poll::Ready(Ok(())) => {},
|
||||
Poll::Ready(Err(_)) => {
|
||||
self.protocols[protocol_index].state =
|
||||
State::Closed { pending_opening: *pending_opening };
|
||||
@@ -840,7 +843,7 @@ impl ConnectionHandler for NotifsHandler {
|
||||
cx,
|
||||
) {
|
||||
Poll::Pending => {},
|
||||
Poll::Ready(Ok(void)) => match void {},
|
||||
Poll::Ready(Ok(())) => {},
|
||||
Poll::Ready(Err(_)) => *in_substream = None,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user