bump libp2p (delayed send, without hooks) (#1413)
* use `switch.isConnected` * libp2p * add timeout to publish * use isConnected * adjust timeouts * latest libp2p master * do not drop peers
This commit is contained in:
parent
5b13d8f3fa
commit
52d9d269d7
|
@ -826,7 +826,7 @@ proc runDiscoveryLoop*(node: Eth2Node) {.async.} =
|
|||
if peerRecord.isOk:
|
||||
let peerInfo = peerRecord.value.toPeerInfo
|
||||
if peerInfo != nil:
|
||||
if peerInfo.id notin node.switch.connections:
|
||||
if not node.switch.isConnected(peerInfo):
|
||||
await node.connQueue.addLast(peerInfo)
|
||||
else:
|
||||
peerInfo.close()
|
||||
|
@ -855,8 +855,8 @@ proc init*(T: type Eth2Node, conf: BeaconNodeConf, enrForkId: ENRForkID,
|
|||
result.switch = switch
|
||||
result.wantedPeers = conf.maxPeers
|
||||
result.peerPool = newPeerPool[Peer, PeerID](maxPeers = conf.maxPeers)
|
||||
result.connectTimeout = 10.seconds
|
||||
result.seenThreshold = 10.minutes
|
||||
result.connectTimeout = 1.minutes
|
||||
result.seenThreshold = 1.minutes
|
||||
result.seenTable = initTable[PeerID, SeenItem]()
|
||||
result.connTable = initTable[PeerID, PeerInfo]()
|
||||
result.connQueue = newAsyncQueue[PeerInfo](ConcurrentConnections)
|
||||
|
@ -1243,7 +1243,7 @@ proc broadcast*(node: Eth2Node, topic: string, msg: auto) =
|
|||
inc nbc_gossip_messages_sent
|
||||
let
|
||||
data = snappy.encode(SSZ.encode(msg))
|
||||
var futSnappy = node.switch.publish(topic & "_snappy", data)
|
||||
var futSnappy = node.switch.publish(topic & "_snappy", data, 1.minutes)
|
||||
traceMessage(futSnappy, gossipId(data))
|
||||
|
||||
# TODO:
|
||||
|
|
|
@ -570,7 +570,7 @@ proc discoveryLoop(conf: InspectorConf,
|
|||
if pinfoOpt.isOk():
|
||||
let pinfo = pinfoOpt.get()
|
||||
if pinfo.hasTCP():
|
||||
if pinfo.id() notin switch.connections:
|
||||
if not switch.isConnected(pinfo):
|
||||
debug "Discovered new peer", peer = pinfo,
|
||||
peers_count = len(peers)
|
||||
await connQueue.addLast(pinfo)
|
||||
|
|
|
@ -226,7 +226,8 @@ proc handleStatus(peer: Peer,
|
|||
|
||||
if not res:
|
||||
debug "Peer is dead or already in pool", peer
|
||||
await peer.disconnect(ClientShutDown)
|
||||
# TODO: DON NOT DROP THE PEER!
|
||||
# await peer.disconnect(ClientShutDown)
|
||||
|
||||
peer.setStatusMsg(theirStatus)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 775cab414a68843c93c75e357f69cb1c04b32edd
|
||||
Subproject commit 980764774efe55f95412555d612bc1bee39396f3
|
Loading…
Reference in New Issue