diff --git a/src/client/mod.rs b/src/client/mod.rs index 8c3f08c6..8db8a99c 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -437,6 +437,8 @@ pub struct ClientStream { stream: SplitStream, // In case the client stream also handles outgoing messages. outgoing: Option, + + terminated: bool, } impl ClientStream { @@ -453,11 +455,16 @@ impl ClientStream { Ok(output) } + + /// marks this stream as terminated + pub fn set_terminated(&mut self) { + self.terminated = true; + } } impl FusedStream for ClientStream { fn is_terminated(&self) -> bool { - false + self.terminated } } @@ -992,6 +999,7 @@ impl Client { state: Arc::clone(&self.state), stream, outgoing: self.outgoing.take(), + terminated: false, }) }