aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/conn.rs6
-rw-r--r--src/netapp.rs2
-rw-r--r--src/peering/basalt.rs4
-rw-r--r--src/peering/fullmesh.rs2
-rw-r--r--src/proto.rs2
-rw-r--r--src/util.rs6
6 files changed, 11 insertions, 11 deletions
diff --git a/src/conn.rs b/src/conn.rs
index daa0235..6c5f38a 100644
--- a/src/conn.rs
+++ b/src/conn.rs
@@ -102,7 +102,7 @@ impl ServerConn {
}
pub fn close(&self) {
- self.close_send.broadcast(true).unwrap();
+ self.close_send.send(true).unwrap();
}
}
@@ -217,7 +217,7 @@ impl ClientConn {
.log_err("could not write None in query_send");
if self.inflight.lock().unwrap().is_empty() {
self.stop_recv_loop
- .broadcast(true)
+ .send(true)
.log_err("could not write true to stop_recv_loop");
}
}
@@ -274,7 +274,7 @@ impl RecvLoop for ClientConn {
if inflight.is_empty() && self.must_exit.load(atomic::Ordering::SeqCst) {
self.stop_recv_loop
- .broadcast(true)
+ .send(true)
.log_err("could not write true to stop_recv_loop");
}
}
diff --git a/src/netapp.rs b/src/netapp.rs
index 0ddd447..5847f98 100644
--- a/src/netapp.rs
+++ b/src/netapp.rs
@@ -202,7 +202,7 @@ impl NetApp {
};
self.listen_params.store(Some(Arc::new(listen_params)));
- let mut listener = TcpListener::bind(listen_addr).await.unwrap();
+ let listener = TcpListener::bind(listen_addr).await.unwrap();
info!("Listening on {}", listen_addr);
loop {
diff --git a/src/peering/basalt.rs b/src/peering/basalt.rs
index 3c1fc9e..abfe1e4 100644
--- a/src/peering/basalt.rs
+++ b/src/peering/basalt.rs
@@ -321,7 +321,7 @@ impl Basalt {
async fn run_pushpull_loop(self: Arc<Self>) {
loop {
- tokio::time::delay_for(self.param.exchange_interval).await;
+ tokio::time::sleep(self.param.exchange_interval).await;
let peers = self.view.read().unwrap().sample(2);
if peers.len() == 2 {
@@ -368,7 +368,7 @@ impl Basalt {
async fn run_reset_loop(self: Arc<Self>) {
loop {
- tokio::time::delay_for(self.param.reset_interval).await;
+ tokio::time::sleep(self.param.reset_interval).await;
{
debug!("KYEV R {}", self.param.reset_count);
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs
index a4b9248..9b55180 100644
--- a/src/peering/fullmesh.rs
+++ b/src/peering/fullmesh.rs
@@ -241,7 +241,7 @@ impl FullMeshPeeringStrategy {
}
// 4. Sleep before next loop iteration
- tokio::time::delay_for(LOOP_DELAY).await;
+ tokio::time::sleep(LOOP_DELAY).await;
}
}
diff --git a/src/proto.rs b/src/proto.rs
index 7b8aa4b..bfef8e7 100644
--- a/src/proto.rs
+++ b/src/proto.rs
@@ -36,7 +36,7 @@ pub const PRIO_NORMAL: RequestPriority = 0x40;
pub const PRIO_BACKGROUND: RequestPriority = 0x80;
/// Priority: primary among given class
pub const PRIO_PRIMARY: RequestPriority = 0x00;
-/// Priority: secondary among given class (ex: `PRIO_HIGH || PRIO_SECONDARY`)
+/// Priority: secondary among given class (ex: `PRIO_HIGH | PRIO_SECONDARY`)
pub const PRIO_SECONDARY: RequestPriority = 0x01;
const MAX_CHUNK_SIZE: usize = 0x4000;
diff --git a/src/util.rs b/src/util.rs
index faeea79..ba485bf 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -32,9 +32,9 @@ where
/// )
/// ```
pub async fn await_exit(mut must_exit: watch::Receiver<bool>) {
- loop {
- if must_exit.recv().await == Some(true) {
- return;
+ while !*must_exit.borrow_and_update() {
+ if must_exit.changed().await.is_err() {
+ break;
}
}
}