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
|
||||
if pubSubPeer.sendConn != nil:
|
||||
g.peersInIP.withValue(pubSubPeer.sendConn.observedAddr, s):
|
||||
s[].excl(pubSubPeer)
|
||||
s[].excl(pubSubPeer.peerId)
|
||||
if s[].len == 0:
|
||||
g.peersInIP.del(pubSubPeer.sendConn.observedAddr)
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ proc colocationFactor(g: GossipSub, peer: PubSubPeer): float64 =
|
|||
let
|
||||
address = peer.sendConn.observedAddr
|
||||
|
||||
g.peersInIP.mgetOrPut(address, initHashSet[PubSubPeer]()).incl(peer)
|
||||
g.peersInIP.mgetOrPut(address, initHashSet[PeerID]()).incl(peer.peerId)
|
||||
let
|
||||
ipPeers = g.peersInIP[address]
|
||||
len = ipPeers.len.float64
|
||||
|
|
|
@ -146,7 +146,7 @@ type
|
|||
parameters*: GossipSubParams
|
||||
topicParams*: Table[string, TopicParams]
|
||||
directPeersLoop*: Future[void]
|
||||
peersInIP*: Table[MultiAddress, HashSet[PubSubPeer]]
|
||||
peersInIP*: Table[MultiAddress, HashSet[PeerID]]
|
||||
|
||||
heartbeatEvents*: seq[AsyncEvent]
|
||||
|
||||
|
|
Loading…
Reference in New Issue