mirror of https://github.com/vacp2p/nim-libp2p.git
* gossip pruning fixes related to #371 * better trace for grafted/pruned * shorted azure testing again
This commit is contained in:
parent
03f5bbba6d
commit
4a98a8af5a
|
@ -59,8 +59,6 @@ task testpubsub_slim, "Runs pubsub tests":
|
||||||
runTest("pubsub/testgossipinternal", sign = false, verify = false, moreoptions = "-d:pubsub_internal_testing")
|
runTest("pubsub/testgossipinternal", sign = false, verify = false, moreoptions = "-d:pubsub_internal_testing")
|
||||||
runTest("pubsub/testpubsub")
|
runTest("pubsub/testpubsub")
|
||||||
runTest("pubsub/testpubsub", sign = false, verify = false, moreoptions = "-d:libp2p_pubsub_anonymize=true")
|
runTest("pubsub/testpubsub", sign = false, verify = false, moreoptions = "-d:libp2p_pubsub_anonymize=true")
|
||||||
runTest("pubsub/testgossipinternal10", sign = false, verify = false, moreoptions = "-d:pubsub_internal_testing")
|
|
||||||
runTest("pubsub/testpubsub", moreoptions = "-d:fallback_gossipsub_10")
|
|
||||||
|
|
||||||
task testfilter, "Run PKI filter test":
|
task testfilter, "Run PKI filter test":
|
||||||
runTest("testpkifilter",
|
runTest("testpkifilter",
|
||||||
|
|
|
@ -304,7 +304,7 @@ proc grafted(g: GossipSub, p: PubSubPeer, topic: string) =
|
||||||
stats.topicInfos[topic] = info
|
stats.topicInfos[topic] = info
|
||||||
assert(g.peerStats[p].topicInfos[topic].inMesh == true)
|
assert(g.peerStats[p].topicInfos[topic].inMesh == true)
|
||||||
|
|
||||||
trace "grafted", p
|
trace "grafted", peer=p, topic
|
||||||
do:
|
do:
|
||||||
g.onNewPeer(p)
|
g.onNewPeer(p)
|
||||||
g.grafted(p, topic)
|
g.grafted(p, topic)
|
||||||
|
@ -329,7 +329,7 @@ proc pruned(g: GossipSub, p: PubSubPeer, topic: string) =
|
||||||
# mgetOrPut does not work, so we gotta do this without referencing
|
# mgetOrPut does not work, so we gotta do this without referencing
|
||||||
stats.topicInfos[topic] = info
|
stats.topicInfos[topic] = info
|
||||||
|
|
||||||
trace "pruned", p
|
trace "pruned", peer=p, topic
|
||||||
|
|
||||||
proc peerExchangeList(g: GossipSub, topic: string): seq[PeerInfoMsg] =
|
proc peerExchangeList(g: GossipSub, topic: string): seq[PeerInfoMsg] =
|
||||||
var peers = g.gossipsub.getOrDefault(topic, initHashSet[PubSubPeer]()).toSeq()
|
var peers = g.gossipsub.getOrDefault(topic, initHashSet[PubSubPeer]()).toSeq()
|
||||||
|
@ -367,7 +367,8 @@ method onPubSubPeerEvent*(p: GossipSub, peer: PubsubPeer, event: PubSubPeerEvent
|
||||||
# If a send connection is lost, it's better to remove peer from the mesh -
|
# If a send connection is lost, it's better to remove peer from the mesh -
|
||||||
# if it gets reestablished, the peer will be readded to the mesh, and if it
|
# if it gets reestablished, the peer will be readded to the mesh, and if it
|
||||||
# doesn't, well.. then we hope the peer is going away!
|
# doesn't, well.. then we hope the peer is going away!
|
||||||
for _, peers in p.mesh.mpairs():
|
for topic, peers in p.mesh.mpairs():
|
||||||
|
p.pruned(peer, topic)
|
||||||
peers.excl(peer)
|
peers.excl(peer)
|
||||||
for _, peers in p.fanout.mpairs():
|
for _, peers in p.fanout.mpairs():
|
||||||
peers.excl(peer)
|
peers.excl(peer)
|
||||||
|
|
|
@ -227,7 +227,7 @@ proc send*(p: PubSubPeer, msg: RPCMsg, anonymize: bool) =
|
||||||
asyncSpawn sendImpl(conn, encoded)
|
asyncSpawn sendImpl(conn, encoded)
|
||||||
|
|
||||||
when defined(libp2p_expensive_metrics):
|
when defined(libp2p_expensive_metrics):
|
||||||
for x in mm.messages:
|
for x in msg.messages:
|
||||||
for t in x.topicIDs:
|
for t in x.topicIDs:
|
||||||
# metrics
|
# metrics
|
||||||
libp2p_pubsub_sent_messages.inc(labelValues = [$p.peerId, t])
|
libp2p_pubsub_sent_messages.inc(labelValues = [$p.peerId, t])
|
||||||
|
|
Loading…
Reference in New Issue