better diagnostics

This commit is contained in:
Giovanni Petrantoni 2020-07-03 09:28:20 +09:00
parent 27d22d534d
commit 0d0309a601
2 changed files with 2 additions and 1 deletions

View File

@ -480,7 +480,7 @@ method publish*(g: GossipSub,
sent.add(peer.send(@[RPCMsg(messages: @[msg])])) sent.add(peer.send(@[RPCMsg(messages: @[msg])]))
else: else:
# Notice this needs a better fix! for now it's a hack # Notice this needs a better fix! for now it's a hack
error "publish: peer or peerInfo was nil" error "publish: peer or peerInfo was nil", missing = p
if topic in g.mesh: if topic in g.mesh:
g.mesh[topic].excl(p) g.mesh[topic].excl(p)
if topic in g.fanout: if topic in g.fanout:

View File

@ -100,6 +100,7 @@ method rpcHandler*(p: PubSub,
method handleDisconnect*(p: PubSub, peer: PubSubPeer) {.async, base.} = method handleDisconnect*(p: PubSub, peer: PubSubPeer) {.async, base.} =
## handle peer disconnects ## handle peer disconnects
if peer.id in p.peers: if peer.id in p.peers:
trace "deleting peer", id = peer.id
p.peers.del(peer.id) p.peers.del(peer.id)
# metrics # metrics