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](),
|
||||
): T =
|
||||
let wf = WakuFilter(
|
||||
subscriptions: FilterSubscriptions.init(
|
||||
subscriptions: FilterSubscriptions.new(
|
||||
subscriptionTimeout, maxFilterPeers, maxFilterCriteriaPerPeer
|
||||
),
|
||||
peerManager: peerManager,
|
||||
|
|
|
@ -40,7 +40,7 @@ type
|
|||
maxPeers: uint
|
||||
maxCriteriaPerPeer: uint
|
||||
|
||||
proc init*(
|
||||
proc new*(
|
||||
T: type FilterSubscriptions,
|
||||
subscriptionTimeout: Duration = DefaultSubscriptionTimeToLiveSec,
|
||||
maxFilterPeers: uint32 = MaxFilterPeers,
|
||||
|
@ -172,6 +172,8 @@ proc addSubscription*(
|
|||
let newPeerData: PeerData =
|
||||
(lastSeen: Moment.now(), criteriaCount: 0, connection: connRes.get())
|
||||
|
||||
peerData = addr(s.peersSubscribed.mgetOrPut(peerId, newPeerData))
|
||||
|
||||
for filterCriterion in filterCriteria:
|
||||
var peersOfSub = addr(s.subscriptions.mgetOrPut(filterCriterion, SubscribedPeers()))
|
||||
if peerId notin peersOfSub[]:
|
||||
|
|
Loading…
Reference in New Issue