aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/simtest/timing.rs8
-rw-r--r--src/swarm/sync.rs4
2 files changed, 4 insertions, 8 deletions
diff --git a/src/simtest/timing.rs b/src/simtest/timing.rs
index 0752f2f..0f19313 100644
--- a/src/simtest/timing.rs
+++ b/src/simtest/timing.rs
@@ -7,7 +7,7 @@ use serde_json::json;
use super::{Sim, has_neighbour, heads, peer, read, write};
use crate::document::replica::Epoch;
-use crate::state::{AppState, Liveness};
+use crate::state::AppState;
use crate::swarm::bootstrap::Start;
use crate::transport::sim::LinkParams;
use crate::transport::{HeadsSummary, HelloRequest, MessageKind, ParsedMessage, RunId, Status};
@@ -232,11 +232,7 @@ async fn peer_goes_dormant_and_returns() {
}
async fn is_dormant(node: &AppState, other: &str) -> bool {
- peer(node, other, |p| {
- matches!(p.liveness, Liveness::Dormant { .. })
- })
- .await
- == Some(true)
+ peer(node, other, |p| p.liveness.is_dormant()).await == Some(true)
}
/// R27: a resent HELLO (its reply was lost) or a late copy of one doesn't reset the
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs
index b34c20b..51144ac 100644
--- a/src/swarm/sync.rs
+++ b/src/swarm/sync.rs
@@ -11,7 +11,7 @@ use tokio::time::Instant;
use tracing::{debug, info, trace, warn};
use crate::locks::MutexExt;
-use crate::state::{AppState, Liveness, PeerState, Standing};
+use crate::state::{AppState, PeerState, Standing};
use crate::swarm::peer::{peer_swarm, send_hello_once};
use crate::swarm::source;
use crate::swarm::throughput::SyncBytes;
@@ -42,7 +42,7 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> {
let validated_swarm = {
let peer_state = peer_state_mutex.lock().await;
- if matches!(peer_state.liveness, Liveness::Dormant { .. }) {
+ if peer_state.liveness.is_dormant() {
// Reactivation re-handshakes, and PeerValidated then restarts sync.
trace!("Skipping sync with dormant peer");
return Ok(());