Skip to content

Commit 81e83bc

Browse files
committed
notification: Fix stalled connection due to dropped wakers in poll_next
Signed-off-by: Alexandru Vasile <[email protected]>
1 parent ea4fbae commit 81e83bc

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/protocol/notification/connection.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,24 +203,21 @@ impl Stream for Connection {
203203
loop {
204204
let notification = match this.next_notification.take() {
205205
Some(notification) => Some(notification),
206-
None => {
207-
let future = async {
208-
tokio::select! {
209-
notification = this.async_rx.recv() => notification,
210-
notification = this.sync_rx.recv() => notification,
211-
}
212-
};
213-
futures::pin_mut!(future);
214-
215-
match future.poll_unpin(cx) {
216-
Poll::Pending => None,
206+
None => match this.async_rx.poll_recv(cx) {
207+
Poll::Ready(Some(notification)) => Some(notification),
208+
Poll::Ready(None) =>
209+
return Poll::Ready(Some(ConnectionEvent::CloseConnection {
210+
notify: NotifyProtocol::Yes,
211+
})),
212+
Poll::Pending => match this.sync_rx.poll_recv(cx) {
213+
Poll::Ready(Some(notification)) => Some(notification),
217214
Poll::Ready(None) =>
218215
return Poll::Ready(Some(ConnectionEvent::CloseConnection {
219216
notify: NotifyProtocol::Yes,
220217
})),
221-
Poll::Ready(Some(notification)) => Some(notification),
222-
}
223-
}
218+
Poll::Pending => None,
219+
},
220+
},
224221
};
225222

226223
let Some(notification) = notification else {

0 commit comments

Comments
 (0)