mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
sc-network: Return on Poll::Pending. (#5295)
If polling encounters a `Poll::Pending` we need to return it instead of continuing the loop which may turn it into a blocking operation, causing problems with executors.
This commit is contained in:
@@ -200,15 +200,19 @@ where TSubstream: AsyncRead + AsyncWrite + Unpin,
|
||||
Err(err) => return Poll::Ready(Some(Err(err))),
|
||||
}
|
||||
},
|
||||
Poll::Pending =>
|
||||
*this.handshake = NotificationsInSubstreamHandshake::PendingSend(msg),
|
||||
Poll::Pending => {
|
||||
*this.handshake = NotificationsInSubstreamHandshake::PendingSend(msg);
|
||||
return Poll::Pending
|
||||
}
|
||||
},
|
||||
NotificationsInSubstreamHandshake::Close =>
|
||||
match Sink::poll_close(this.socket.as_mut(), cx)? {
|
||||
Poll::Ready(()) =>
|
||||
*this.handshake = NotificationsInSubstreamHandshake::Sent,
|
||||
Poll::Pending =>
|
||||
*this.handshake = NotificationsInSubstreamHandshake::Close,
|
||||
Poll::Pending => {
|
||||
*this.handshake = NotificationsInSubstreamHandshake::Close;
|
||||
return Poll::Pending
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user