Fix a little bug.

This commit is contained in:
Sunli 2020-09-11 23:43:26 +08:00
parent 3c01c5ed28
commit 857afb1f54

View File

@ -145,11 +145,9 @@ where
// receive msg // receive msg
if let Some(ctx) = &mut this.ctx { if let Some(ctx) = &mut this.ctx {
if !ctx.streams.is_empty() {
let mut closed = Vec::new(); let mut closed = Vec::new();
for (id, incoming_stream) in ctx.streams.iter_mut() { for (id, incoming_stream) in ctx.streams.iter_mut() {
loop {
match incoming_stream.as_mut().poll_next(cx) { match incoming_stream.as_mut().poll_next(cx) {
Poll::Ready(Some(res)) => { Poll::Ready(Some(res)) => {
if let Some(err) = &res.error { if let Some(err) = &res.error {
@ -183,19 +181,14 @@ where
payload: None, payload: None,
}, },
); );
break;
}
Poll::Pending => {
break;
}
} }
Poll::Pending => {}
} }
} }
for id in closed { for id in closed {
ctx.streams.remove(&id); ctx.streams.remove(&id);
} }
}
if !ctx.send_buf.is_empty() { if !ctx.send_buf.is_empty() {
continue; continue;