diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-12-29 20:13:22 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-12-29 20:13:24 +0100 |
commit | 41154413d411048207cce3c22d68442d795e6a6f (patch) | |
tree | c176faac85a2f17b90a00bcce204f2989a327983 /gui/src/gossip.rs | |
parent | 6265a4a9372e651732f53cd6a129dd50e491245e (diff) |
Remove the GossipHandler, handle in code directly
Use the iced idea of how to act on events rather than having a type for
handling gossip messages.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'gui/src/gossip.rs')
-rw-r--r-- | gui/src/gossip.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gui/src/gossip.rs b/gui/src/gossip.rs index c88c29c..ae941f5 100644 --- a/gui/src/gossip.rs +++ b/gui/src/gossip.rs @@ -5,6 +5,8 @@ use tokio::sync::RwLock; use distrox_lib::profile::Profile; use distrox_lib::client::Client; +use distrox_lib::gossip::GossipDeserializer; +use distrox_lib::gossip::LogStrategy; use crate::app::Message; @@ -35,19 +37,13 @@ where } fn stream(self: Box<Self>, _input: futures::stream::BoxStream<'static, I>) -> futures::stream::BoxStream<'static, Self::Output> { - use distrox_lib::gossip::deserializer; - use distrox_lib::gossip::handler; - // TODO: Do "right", whatever this means... let stream = Arc::try_unwrap(self.subscription).unwrap(); Box::pin({ - let stream = deserializer::GossipDeserializer::<deserializer::LogStrategy>::new().run(stream); - let stream = handler::GossipHandler::<handler::LogStrategy>::new(self.profile.clone()).run(stream); - - stream.map(|(gossip_message, _handling_result)| { - Message::GossipHandled(gossip_message) - }) + GossipDeserializer::<LogStrategy>::new() + .run(stream) + .map(|(source, msg)| Message::GossipMessage(source, msg)) }) } } |