diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index a1c656f01..f2402e058 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -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: diff --git a/beacon_chain/inspector.nim b/beacon_chain/inspector.nim index 4a28325d0..40ada85d2 100644 --- a/beacon_chain/inspector.nim +++ b/beacon_chain/inspector.nim @@ -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) diff --git a/beacon_chain/sync_protocol.nim b/beacon_chain/sync_protocol.nim index 7e0219793..69d3e87ca 100644 --- a/beacon_chain/sync_protocol.nim +++ b/beacon_chain/sync_protocol.nim @@ -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) diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index 775cab414..980764774 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit 775cab414a68843c93c75e357f69cb1c04b32edd +Subproject commit 980764774efe55f95412555d612bc1bee39396f3