minimize hash table accesses
This commit is contained in:
parent
16eeacd798
commit
535c04481e
15
score.go
15
score.go
|
@ -445,18 +445,20 @@ func (ps *peerScore) markFirstMessageDelivery(p peer.ID, msg *Message) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cap := ps.params.Topics[topic].FirstMessageDeliveriesCap
|
||||||
tstats.firstMessageDeliveries += 1
|
tstats.firstMessageDeliveries += 1
|
||||||
if tstats.firstMessageDeliveries > ps.params.Topics[topic].FirstMessageDeliveriesCap {
|
if tstats.firstMessageDeliveries > cap {
|
||||||
tstats.firstMessageDeliveries = ps.params.Topics[topic].FirstMessageDeliveriesCap
|
tstats.firstMessageDeliveries = cap
|
||||||
}
|
}
|
||||||
|
|
||||||
if !tstats.inMesh {
|
if !tstats.inMesh {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cap = ps.params.Topics[topic].MeshMessageDeliveriesCap
|
||||||
tstats.meshMessageDeliveries += 1
|
tstats.meshMessageDeliveries += 1
|
||||||
if tstats.meshMessageDeliveries > ps.params.Topics[topic].MeshMessageDeliveriesCap {
|
if tstats.meshMessageDeliveries > cap {
|
||||||
tstats.meshMessageDeliveries = ps.params.Topics[topic].MeshMessageDeliveriesCap
|
tstats.meshMessageDeliveries = cap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,9 +484,10 @@ func (ps *peerScore) markDuplicateMessageDelivery(p peer.ID, msg *Message, first
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cap := ps.params.Topics[topic].MeshMessageDeliveriesCap
|
||||||
tstats.meshMessageDeliveries += 1
|
tstats.meshMessageDeliveries += 1
|
||||||
if tstats.meshMessageDeliveries > ps.params.Topics[topic].MeshMessageDeliveriesCap {
|
if tstats.meshMessageDeliveries > cap {
|
||||||
tstats.meshMessageDeliveries = ps.params.Topics[topic].MeshMessageDeliveriesCap
|
tstats.meshMessageDeliveries = cap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue