diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-12-21 19:58:53 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-12-21 19:58:53 +0100 |
commit | 286497177a040921ea9687a07436565cfad77384 (patch) | |
tree | 5ce32bb1c94a39ebaac55f2c4ec0b0dee35dd49d /lib/src/gossip/handler.rs | |
parent | 1034a454d0900130796fd8941bbc9696bcc41b29 (diff) | |
parent | 2300a0a871ad8e2de528bfcd4d53d1df812fd5d9 (diff) |
Merge branch 'posting'
Diffstat (limited to 'lib/src/gossip/handler.rs')
-rw-r--r-- | lib/src/gossip/handler.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/src/gossip/handler.rs b/lib/src/gossip/handler.rs index 7c9ffa6..e524da8 100644 --- a/lib/src/gossip/handler.rs +++ b/lib/src/gossip/handler.rs @@ -18,14 +18,14 @@ use crate::gossip::GossipMessage; pub struct GossipHandler<Strategy = LogStrategy> where Strategy: GossipHandlingStrategy + Sync + Send { - profile: Arc<Profile>, + profile: Arc<RwLock<Profile>>, strategy: std::marker::PhantomData<Strategy>, } impl<Strat> GossipHandler<Strat> where Strat: GossipHandlingStrategy + Sync + Send { - pub fn new(profile: Arc<Profile>) -> Self { + pub fn new(profile: Arc<RwLock<Profile>>) -> Self { Self { profile, strategy: std::marker::PhantomData, @@ -48,14 +48,14 @@ impl<Strat> GossipHandler<Strat> #[async_trait::async_trait] pub trait GossipHandlingStrategy: Sync + Send { - async fn handle_gossip_message(profile: Arc<Profile>, source: &ipfs::PeerId, msg: &GossipMessage) -> Result<()>; + async fn handle_gossip_message(profile: Arc<RwLock<Profile>>, source: &ipfs::PeerId, msg: &GossipMessage) -> Result<()>; } pub struct LogStrategy; #[async_trait::async_trait] impl GossipHandlingStrategy for LogStrategy { - async fn handle_gossip_message(_profile: Arc<Profile>, source: &ipfs::PeerId, msg: &GossipMessage) -> Result<()> { + async fn handle_gossip_message(_profile: Arc<RwLock<Profile>>, source: &ipfs::PeerId, msg: &GossipMessage) -> Result<()> { use std::convert::TryFrom; use std::ops::Deref; |