aboutsummaryrefslogtreecommitdiff
path: root/src/peering/fullmesh.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-21 20:22:56 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-21 20:22:56 +0200
commit4934ed726d51913afd97ca937d0ece39ef8b7371 (patch)
treead9560d819bfcbab9e35ee806bd9b2adaa8f9de5 /src/peering/fullmesh.rs
parent7d148c7e764d563efa3bccc0f14f50867db38ef1 (diff)
downloadnetapp-4934ed726d51913afd97ca937d0ece39ef8b7371.tar.gz
netapp-4934ed726d51913afd97ca937d0ece39ef8b7371.zip
Propose alternative API
Diffstat (limited to 'src/peering/fullmesh.rs')
-rw-r--r--src/peering/fullmesh.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs
index f8348af..9b7b666 100644
--- a/src/peering/fullmesh.rs
+++ b/src/peering/fullmesh.rs
@@ -583,13 +583,14 @@ impl FullMeshPeeringStrategy {
#[async_trait]
impl EndpointHandler<PingMessage> for FullMeshPeeringStrategy {
- async fn handle(self: &Arc<Self>, ping: PingMessage, from: NodeID) -> PingMessage {
+ async fn handle(self: &Arc<Self>, ping: Req<PingMessage>, from: NodeID) -> Resp<PingMessage> {
+ let ping = ping.msg();
let ping_resp = PingMessage {
id: ping.id,
peer_list_hash: self.known_hosts.read().unwrap().hash,
};
debug!("Ping from {}", hex::encode(&from[..8]));
- ping_resp
+ Resp::new(ping_resp)
}
}
@@ -597,11 +598,12 @@ impl EndpointHandler<PingMessage> for FullMeshPeeringStrategy {
impl EndpointHandler<PeerListMessage> for FullMeshPeeringStrategy {
async fn handle(
self: &Arc<Self>,
- peer_list: PeerListMessage,
+ peer_list: Req<PeerListMessage>,
_from: NodeID,
- ) -> PeerListMessage {
+ ) -> Resp<PeerListMessage> {
+ let peer_list = peer_list.msg();
self.handle_peer_list(&peer_list.list[..]);
let peer_list = KnownHosts::map_into_vec(&self.known_hosts.read().unwrap().list);
- PeerListMessage { list: peer_list }
+ Resp::new(PeerListMessage { list: peer_list })
}
}