mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-03-03 09:31:08 +00:00
Fix & test shortAgent
This commit is contained in:
parent
0d6c60df05
commit
15a107a368
@ -75,7 +75,9 @@ when defined(libp2p_agents_metrics):
|
|||||||
if p.sendConn.isNil:
|
if p.sendConn.isNil:
|
||||||
"unknown"
|
"unknown"
|
||||||
else:
|
else:
|
||||||
p.sendConn.shortAgent
|
#TODO the sendConn is setup before identify,
|
||||||
|
#so we have to read the parents short agent..
|
||||||
|
p.sendConn.getWrapped().shortAgent
|
||||||
|
|
||||||
func hash*(p: PubSubPeer): Hash =
|
func hash*(p: PubSubPeer): Hash =
|
||||||
p.peerId.hash
|
p.peerId.hash
|
||||||
|
@ -57,5 +57,5 @@ when defined(libp2p_agents_metrics):
|
|||||||
err("toLowerAscii failed")
|
err("toLowerAscii failed")
|
||||||
|
|
||||||
const
|
const
|
||||||
KnownLibP2PAgents* {.strdefine.} = ""
|
KnownLibP2PAgents* {.strdefine.} = "nim-libp2p"
|
||||||
KnownLibP2PAgentsSeq* = KnownLibP2PAgents.safeToLowerAscii().tryGet().split(",")
|
KnownLibP2PAgentsSeq* = KnownLibP2PAgents.safeToLowerAscii().tryGet().split(",")
|
||||||
|
@ -19,7 +19,9 @@ import utils,
|
|||||||
protocols/pubsub/pubsub,
|
protocols/pubsub/pubsub,
|
||||||
protocols/pubsub/floodsub,
|
protocols/pubsub/floodsub,
|
||||||
protocols/pubsub/rpc/messages,
|
protocols/pubsub/rpc/messages,
|
||||||
protocols/pubsub/peertable]
|
protocols/pubsub/peertable,
|
||||||
|
protocols/pubsub/pubsubpeer
|
||||||
|
]
|
||||||
import ../../libp2p/protocols/pubsub/errors as pubsub_errors
|
import ../../libp2p/protocols/pubsub/errors as pubsub_errors
|
||||||
|
|
||||||
import ../helpers
|
import ../helpers
|
||||||
@ -62,6 +64,14 @@ suite "FloodSub":
|
|||||||
check (await nodes[0].publish("foobar", "Hello!".toBytes())) > 0
|
check (await nodes[0].publish("foobar", "Hello!".toBytes())) > 0
|
||||||
check (await completionFut.wait(5.seconds)) == true
|
check (await completionFut.wait(5.seconds)) == true
|
||||||
|
|
||||||
|
when defined(libp2p_agents_metrics):
|
||||||
|
let
|
||||||
|
agentA = nodes[0].peers[nodes[1].switch.peerInfo.peerId].shortAgent
|
||||||
|
agentB = nodes[1].peers[nodes[0].switch.peerInfo.peerId].shortAgent
|
||||||
|
check:
|
||||||
|
agentA == "nim-libp2p"
|
||||||
|
agentB == "nim-libp2p"
|
||||||
|
|
||||||
await allFuturesThrowing(
|
await allFuturesThrowing(
|
||||||
nodes[0].switch.stop(),
|
nodes[0].switch.stop(),
|
||||||
nodes[1].switch.stop()
|
nodes[1].switch.stop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user