Fixed the bug that can accept subscription requests during the initialization of WebSocket.
This commit is contained in:
parent
244aa37738
commit
d193a138e3
|
@ -93,6 +93,7 @@ where
|
||||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
|
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
|
||||||
let mut this = self.project();
|
let mut this = self.project();
|
||||||
|
|
||||||
|
if this.init_fut.is_none() {
|
||||||
while let Poll::Ready(message) = Pin::new(&mut this.stream).poll_next(cx) {
|
while let Poll::Ready(message) = Pin::new(&mut this.stream).poll_next(cx) {
|
||||||
let message = match message {
|
let message = match message {
|
||||||
Some(message) => message,
|
Some(message) => message,
|
||||||
|
@ -117,6 +118,7 @@ where
|
||||||
*this.init_fut = Some(Box::pin(async move {
|
*this.init_fut = Some(Box::pin(async move {
|
||||||
data_initializer(payload.unwrap_or_default()).await
|
data_initializer(payload.unwrap_or_default()).await
|
||||||
}));
|
}));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClientMessage::Start {
|
ClientMessage::Start {
|
||||||
|
@ -144,6 +146,7 @@ where
|
||||||
ClientMessage::ConnectionTerminate => return Poll::Ready(None),
|
ClientMessage::ConnectionTerminate => return Poll::Ready(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(init_fut) = this.init_fut {
|
if let Some(init_fut) = this.init_fut {
|
||||||
if let Poll::Ready(res) = init_fut.poll_unpin(cx) {
|
if let Poll::Ready(res) = init_fut.poll_unpin(cx) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user