Fix server kicking clients off when a source left
This commit is contained in:
parent
32c72e1ee8
commit
a5baa39014
1 changed files with 3 additions and 10 deletions
|
@ -91,16 +91,9 @@ impl Sink<Chunk> for Transmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll_close(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<(), Never>> {
|
fn poll_close(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<(), Never>> {
|
||||||
let mut channel = self.channel.lock().expect("Locking channel");
|
// don't actually disconnect listeners, since other sources may want to transmit to this channel;
|
||||||
|
// just ensure we've sent everything we can out
|
||||||
// there's no useful error we can offer here, just give everything a chance to try closing
|
self.poll_flush(cx)
|
||||||
channel.listeners.retain_mut(|listener| Pin::new(listener).poll_close(cx).is_pending());
|
|
||||||
|
|
||||||
return if channel.listeners.len() > 0 {
|
|
||||||
Poll::Pending
|
|
||||||
} else {
|
|
||||||
Poll::Ready(Ok(()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue