From 6eb651d43ae4ea5fbe9ecd4b021a92fb4af39575 Mon Sep 17 00:00:00 2001 From: Giovanni Petrantoni Date: Wed, 15 Jul 2020 17:07:17 +0900 Subject: [PATCH] control prune updates (pb) --- libp2p/protocols/pubsub/rpc/protobuf.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libp2p/protocols/pubsub/rpc/protobuf.nim b/libp2p/protocols/pubsub/rpc/protobuf.nim index c5a3eb309..6ca4ae80e 100644 --- a/libp2p/protocols/pubsub/rpc/protobuf.nim +++ b/libp2p/protocols/pubsub/rpc/protobuf.nim @@ -20,9 +20,19 @@ proc write*(pb: var ProtoBuffer, field: int, graft: ControlGraft) = ipb.finish() pb.write(field, ipb) +proc write*(pb: var ProtoBuffer, field: int, infoMsg: PeerInfoMsg) = + var ipb = initProtoBuffer() + ipb.write(1, infoMsg.peerID) + ipb.write(2, infoMsg.signedPeerRecord) + ipb.finish() + pb.write(field, ipb) + proc write*(pb: var ProtoBuffer, field: int, prune: ControlPrune) = var ipb = initProtoBuffer() ipb.write(1, prune.topicID) + for peer in prune.peers: + ipb.write(2, peer) + ipb.write(3, prune.backoff) ipb.finish() pb.write(field, ipb)