diff options
Diffstat (limited to '')
| -rw-r--r-- | lampada/src/connection/read.rs | 7 | 
1 files changed, 4 insertions, 3 deletions
diff --git a/lampada/src/connection/read.rs b/lampada/src/connection/read.rs index 640ca8e..2c7eb58 100644 --- a/lampada/src/connection/read.rs +++ b/lampada/src/connection/read.rs @@ -7,6 +7,7 @@ use std::{      time::Duration,  }; +use futures::{future::Fuse, FutureExt};  use luz::{connection::Tls, jabber_stream::bound_stream::BoundJabberReader};  use stanza::client::Stanza;  use stanza::stream::Error as StreamErrorStanza; @@ -25,7 +26,7 @@ use super::{write::WriteHandle, SupervisorCommand, SupervisorSender};  pub struct Read<Lgc> {      stream: BoundJabberReader<Tls>,      disconnecting: bool, -    disconnect_timedout: oneshot::Receiver<()>, +    disconnect_timedout: Fuse<oneshot::Receiver<()>>,      // all the threads spawned by the current connection session      tasks: JoinSet<()>, @@ -62,7 +63,7 @@ impl<Lgc> Read<Lgc> {          Self {              stream,              disconnecting: false, -            disconnect_timedout: recv, +            disconnect_timedout: recv.fuse(),              tasks,              connected,              logic, @@ -91,7 +92,7 @@ impl<Lgc: Clone + Logic + Send + 'static> Read<Lgc> {                          // when disconnect received,                          ReadControl::Disconnect => {                              let (send, recv) = oneshot::channel(); -                            self.disconnect_timedout = recv; +                            self.disconnect_timedout = recv.fuse();                              self.disconnecting = true;                              tokio::spawn(async {                                  tokio::time::sleep(Duration::from_secs(10)).await;  | 
