summaryrefslogtreecommitdiffstats
path: root/src/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/node.rs')
-rw-r--r--src/node.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/node.rs b/src/node.rs
index 8e4ace7..8aab601 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -23,7 +23,7 @@ use crate::swarm::state_file::StateFile;
use crate::swarm::sync::SyncEvent;
use crate::swarm::{self, peer, sync};
use crate::transport::Transport;
-use crate::transport::firewall::{Firewall, FirewallTransport};
+use crate::transport::firewall::Firewall;
use crate::transport::identity::{IdentityConfig, IdentityTransport};
use crate::transport::traffic::{CountingTransport, Traffic};
@@ -77,6 +77,7 @@ impl Node {
config.transport,
identity,
Arc::clone(&traffic),
+ Some(Arc::clone(&firewall)),
)) as Arc<dyn Transport>,
None => config.transport,
};
@@ -84,20 +85,18 @@ impl Node {
let replica = Replica::new(config.initial_epoch, config.initial_doc);
let stamp = replica.stamps();
let state = AppState {
- doc: Arc::new(RwLock::new(replica)),
+ doc: Arc::new(crate::document::lock::DocumentLock::new(replica)),
epoch_tx,
stamp,
lifecycle: Arc::new(RwLock::new(NodeLifecycle::Joining {
discovered_swarm_id: None,
})),
peer_states: Arc::new(RwLock::new(HashMap::new())),
- // Counted outside the firewall: what it drops outbound counts as sent (it
- // plays a lossy network), what it drops inbound never arrived. Both above
- // the identity layer, so by node ID.
- transport: Arc::new(CountingTransport::new(
- Arc::new(FirewallTransport::new(transport, Arc::clone(&firewall))),
- Arc::clone(&traffic),
- )),
+ // Counted above the firewall (in the paths layer, under the identity layer):
+ // what it drops outbound counts as sent (it plays a lossy network), what it
+ // drops inbound never arrived. Without the identity layer (tests) there is
+ // no firewall.
+ transport: Arc::new(CountingTransport::new(transport, Arc::clone(&traffic))),
firewall,
traffic,
stats: Default::default(),