control prune updates (pb)

This commit is contained in:
Giovanni Petrantoni 2020-07-15 17:07:17 +09:00
parent 73972ec9ce
commit 6eb651d43a
1 changed files with 10 additions and 0 deletions

View File

@ -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)