mirror of
https://github.com/codex-storage/nim-libp2p.git
synced 2025-01-13 20:44:20 +00:00
use in any case PeerID for peersInIP to avoid keeping references
This commit is contained in:
parent
fae38e0146
commit
67d0926e89
@ -198,7 +198,7 @@ method unsubscribePeer*(g: GossipSub, peer: PeerID) =
|
|||||||
# remove from peer IPs collection too
|
# remove from peer IPs collection too
|
||||||
if pubSubPeer.sendConn != nil:
|
if pubSubPeer.sendConn != nil:
|
||||||
g.peersInIP.withValue(pubSubPeer.sendConn.observedAddr, s):
|
g.peersInIP.withValue(pubSubPeer.sendConn.observedAddr, s):
|
||||||
s[].excl(pubSubPeer)
|
s[].excl(pubSubPeer.peerId)
|
||||||
if s[].len == 0:
|
if s[].len == 0:
|
||||||
g.peersInIP.del(pubSubPeer.sendConn.observedAddr)
|
g.peersInIP.del(pubSubPeer.sendConn.observedAddr)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ proc colocationFactor(g: GossipSub, peer: PubSubPeer): float64 =
|
|||||||
let
|
let
|
||||||
address = peer.sendConn.observedAddr
|
address = peer.sendConn.observedAddr
|
||||||
|
|
||||||
g.peersInIP.mgetOrPut(address, initHashSet[PubSubPeer]()).incl(peer)
|
g.peersInIP.mgetOrPut(address, initHashSet[PeerID]()).incl(peer.peerId)
|
||||||
let
|
let
|
||||||
ipPeers = g.peersInIP[address]
|
ipPeers = g.peersInIP[address]
|
||||||
len = ipPeers.len.float64
|
len = ipPeers.len.float64
|
||||||
|
@ -146,7 +146,7 @@ type
|
|||||||
parameters*: GossipSubParams
|
parameters*: GossipSubParams
|
||||||
topicParams*: Table[string, TopicParams]
|
topicParams*: Table[string, TopicParams]
|
||||||
directPeersLoop*: Future[void]
|
directPeersLoop*: Future[void]
|
||||||
peersInIP*: Table[MultiAddress, HashSet[PubSubPeer]]
|
peersInIP*: Table[MultiAddress, HashSet[PeerID]]
|
||||||
|
|
||||||
heartbeatEvents*: seq[AsyncEvent]
|
heartbeatEvents*: seq[AsyncEvent]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user