aboutsummaryrefslogtreecommitdiffstats
path: root/luz/src/connection/read.rs
diff options
context:
space:
mode:
Diffstat (limited to 'luz/src/connection/read.rs')
-rw-r--r--luz/src/connection/read.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/luz/src/connection/read.rs b/luz/src/connection/read.rs
index 692952b..8f8c4a0 100644
--- a/luz/src/connection/read.rs
+++ b/luz/src/connection/read.rs
@@ -13,7 +13,11 @@ use tokio::{
};
use tracing::info;
-use crate::{db::Db, error::Error, UpdateMessage};
+use crate::{
+ db::Db,
+ error::{Error, Reason},
+ UpdateMessage,
+};
use super::{
write::{WriteHandle, WriteMessage},
@@ -29,7 +33,7 @@ pub struct Read {
JoinSet<()>,
mpsc::Sender<SupervisorCommand>,
WriteHandle,
- Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
)>,
db: Db,
update_sender: mpsc::Sender<UpdateMessage>,
@@ -39,7 +43,7 @@ pub struct Read {
disconnecting: bool,
disconnect_timedout: oneshot::Receiver<()>,
// TODO: use proper stanza ids
- pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
}
impl Read {
@@ -52,7 +56,7 @@ impl Read {
JoinSet<()>,
mpsc::Sender<SupervisorCommand>,
WriteHandle,
- Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
)>,
db: Db,
update_sender: mpsc::Sender<UpdateMessage>,
@@ -60,7 +64,7 @@ impl Read {
supervisor_control: mpsc::Sender<SupervisorCommand>,
write_handle: WriteHandle,
tasks: JoinSet<()>,
- pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
) -> Self {
let (send, recv) = oneshot::channel();
Self {
@@ -153,7 +157,7 @@ impl Read {
// when it aborts, must clear iq map no matter what
let mut iqs = self.pending_iqs.lock().await;
for (_id, sender) in iqs.drain() {
- let _ = sender.send(Err(Error::LostConnection));
+ let _ = sender.send(Err(Reason::LostConnection));
}
}
}
@@ -182,7 +186,7 @@ pub enum ReadControl {
JoinSet<()>,
mpsc::Sender<SupervisorCommand>,
WriteHandle,
- Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
)>,
),
}
@@ -215,13 +219,13 @@ impl ReadControlHandle {
JoinSet<()>,
mpsc::Sender<SupervisorCommand>,
WriteHandle,
- Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
)>,
db: Db,
sender: mpsc::Sender<UpdateMessage>,
supervisor_control: mpsc::Sender<SupervisorCommand>,
jabber_write: WriteHandle,
- pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
) -> Self {
let (control_sender, control_receiver) = mpsc::channel(20);
@@ -252,14 +256,14 @@ impl ReadControlHandle {
JoinSet<()>,
mpsc::Sender<SupervisorCommand>,
WriteHandle,
- Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
)>,
db: Db,
sender: mpsc::Sender<UpdateMessage>,
supervisor_control: mpsc::Sender<SupervisorCommand>,
jabber_write: WriteHandle,
tasks: JoinSet<()>,
- pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Error>>>>>,
+ pending_iqs: Arc<Mutex<HashMap<String, oneshot::Sender<Result<Stanza, Reason>>>>>,
) -> Self {
let (control_sender, control_receiver) = mpsc::channel(20);