mirror of https://github.com/waku-org/nwaku.git
filter: some adjustments to avoid crash and use new insteat init
This commit is contained in:
parent
26a2112c5d
commit
b9931e277d
|
@ -330,7 +330,7 @@ proc new*(
|
||||||
rateLimitSetting: Option[RateLimitSetting] = none[RateLimitSetting](),
|
rateLimitSetting: Option[RateLimitSetting] = none[RateLimitSetting](),
|
||||||
): T =
|
): T =
|
||||||
let wf = WakuFilter(
|
let wf = WakuFilter(
|
||||||
subscriptions: FilterSubscriptions.init(
|
subscriptions: FilterSubscriptions.new(
|
||||||
subscriptionTimeout, maxFilterPeers, maxFilterCriteriaPerPeer
|
subscriptionTimeout, maxFilterPeers, maxFilterCriteriaPerPeer
|
||||||
),
|
),
|
||||||
peerManager: peerManager,
|
peerManager: peerManager,
|
||||||
|
|
|
@ -40,7 +40,7 @@ type
|
||||||
maxPeers: uint
|
maxPeers: uint
|
||||||
maxCriteriaPerPeer: uint
|
maxCriteriaPerPeer: uint
|
||||||
|
|
||||||
proc init*(
|
proc new*(
|
||||||
T: type FilterSubscriptions,
|
T: type FilterSubscriptions,
|
||||||
subscriptionTimeout: Duration = DefaultSubscriptionTimeToLiveSec,
|
subscriptionTimeout: Duration = DefaultSubscriptionTimeToLiveSec,
|
||||||
maxFilterPeers: uint32 = MaxFilterPeers,
|
maxFilterPeers: uint32 = MaxFilterPeers,
|
||||||
|
@ -172,6 +172,8 @@ proc addSubscription*(
|
||||||
let newPeerData: PeerData =
|
let newPeerData: PeerData =
|
||||||
(lastSeen: Moment.now(), criteriaCount: 0, connection: connRes.get())
|
(lastSeen: Moment.now(), criteriaCount: 0, connection: connRes.get())
|
||||||
|
|
||||||
|
peerData = addr(s.peersSubscribed.mgetOrPut(peerId, newPeerData))
|
||||||
|
|
||||||
for filterCriterion in filterCriteria:
|
for filterCriterion in filterCriteria:
|
||||||
var peersOfSub = addr(s.subscriptions.mgetOrPut(filterCriterion, SubscribedPeers()))
|
var peersOfSub = addr(s.subscriptions.mgetOrPut(filterCriterion, SubscribedPeers()))
|
||||||
if peerId notin peersOfSub[]:
|
if peerId notin peersOfSub[]:
|
||||||
|
|
Loading…
Reference in New Issue