aboutsummaryrefslogtreecommitdiffstats
path: root/lampada
diff options
context:
space:
mode:
Diffstat (limited to 'lampada')
-rw-r--r--lampada/Cargo.toml2
-rw-r--r--lampada/src/connection/read.rs7
2 files changed, 5 insertions, 4 deletions
diff --git a/lampada/Cargo.toml b/lampada/Cargo.toml
index 9b42aad..c68f9c6 100644
--- a/lampada/Cargo.toml
+++ b/lampada/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
futures = "0.3.31"
luz = { version = "0.1.0", path = "../luz" }
-peanuts = { version = "0.1.0", path = "../../peanuts" }
+peanuts = { version = "0.1.0", git = "https://bunny.garden/peanuts" }
jid = { version = "0.1.0", path = "../jid", features = ["sqlx"] }
stanza = { version = "0.1.0", path = "../stanza", features = ["xep_0203"] }
tokio = "1.42.0"
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;