don't send messages to self

This commit is contained in:
Dmitriy Ryajov 2019-10-02 15:43:00 -06:00
parent 31c7dd38b8
commit 6cfbf2c124
1 changed files with 3 additions and 1 deletions

View File

@ -69,6 +69,7 @@ proc rpcHandler(f: FloodSub,
# send subscriptions to every peer # send subscriptions to every peer
for p in f.peers.values: for p in f.peers.values:
# if p.id != peer.id:
await p.send(@[RPCMsg(subscriptions: m.subscriptions)]) await p.send(@[RPCMsg(subscriptions: m.subscriptions)])
var toSendPeers: HashSet[string] = initSet[string]() var toSendPeers: HashSet[string] = initSet[string]()
@ -82,6 +83,7 @@ proc rpcHandler(f: FloodSub,
# forward the message to all peers interested in it # forward the message to all peers interested in it
for p in toSendPeers: for p in toSendPeers:
if f.peers[p].id != peer.id:
await f.peers[p].send(@[RPCMsg(messages: m.messages)]) await f.peers[p].send(@[RPCMsg(messages: m.messages)])
proc handleConn(f: FloodSub, proc handleConn(f: FloodSub,