diff options
Diffstat (limited to 'src/peering')
-rw-r--r-- | src/peering/basalt.rs | 17 | ||||
-rw-r--r-- | src/peering/fullmesh.rs | 12 |
2 files changed, 9 insertions, 20 deletions
diff --git a/src/peering/basalt.rs b/src/peering/basalt.rs index 71dea84..310077f 100644 --- a/src/peering/basalt.rs +++ b/src/peering/basalt.rs @@ -468,24 +468,15 @@ impl Basalt { #[async_trait] impl EndpointHandler<PullMessage> for Basalt { - async fn handle( - self: &Arc<Self>, - _pullmsg: Req<PullMessage>, - _from: NodeID, - ) -> Resp<PullMessage> { - Resp::new(self.make_push_message()) + async fn handle(self: &Arc<Self>, _pullmsg: &PullMessage, _from: NodeID) -> PushMessage { + self.make_push_message() } } #[async_trait] impl EndpointHandler<PushMessage> for Basalt { - async fn handle( - self: &Arc<Self>, - pushmsg: Req<PushMessage>, - _from: NodeID, - ) -> Resp<PushMessage> { - self.handle_peer_list(&pushmsg.msg().peers[..]); - Resp::new(()) + async fn handle(self: &Arc<Self>, pushmsg: &PushMessage, _from: NodeID) { + self.handle_peer_list(&pushmsg.peers[..]); } } diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs index 9b7b666..ccbd0ba 100644 --- a/src/peering/fullmesh.rs +++ b/src/peering/fullmesh.rs @@ -583,14 +583,13 @@ impl FullMeshPeeringStrategy { #[async_trait] impl EndpointHandler<PingMessage> for FullMeshPeeringStrategy { - async fn handle(self: &Arc<Self>, ping: Req<PingMessage>, from: NodeID) -> Resp<PingMessage> { - let ping = ping.msg(); + async fn handle(self: &Arc<Self>, ping: &PingMessage, from: NodeID) -> PingMessage { let ping_resp = PingMessage { id: ping.id, peer_list_hash: self.known_hosts.read().unwrap().hash, }; debug!("Ping from {}", hex::encode(&from[..8])); - Resp::new(ping_resp) + ping_resp } } @@ -598,12 +597,11 @@ impl EndpointHandler<PingMessage> for FullMeshPeeringStrategy { impl EndpointHandler<PeerListMessage> for FullMeshPeeringStrategy { async fn handle( self: &Arc<Self>, - peer_list: Req<PeerListMessage>, + peer_list: &PeerListMessage, _from: NodeID, - ) -> Resp<PeerListMessage> { - let peer_list = peer_list.msg(); + ) -> PeerListMessage { self.handle_peer_list(&peer_list.list[..]); let peer_list = KnownHosts::map_into_vec(&self.known_hosts.read().unwrap().list); - Resp::new(PeerListMessage { list: peer_list }) + PeerListMessage { list: peer_list } } } |