mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 01:43:47 +00:00
pss: remove expired entries from forward cache
This commit is contained in:
parent
c9283b79f9
commit
c63b036812
1 changed files with 11 additions and 0 deletions
|
|
@ -756,6 +756,17 @@ func (self *Pss) forward(msg *PssMsg) {
|
||||||
// SECTION: Caching
|
// SECTION: Caching
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// remove expired entries from forward cache
|
||||||
|
func (self *Pss) cleanFwdCache() {
|
||||||
|
self.fwdCacheMu.Lock()
|
||||||
|
defer self.fwdCacheMu.Unlock()
|
||||||
|
for k,v := range self.fwdCache {
|
||||||
|
if v.expiresAt.Before(time.Now()) {
|
||||||
|
delete(self.fwdCache[k])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add a message to the cache
|
// add a message to the cache
|
||||||
func (self *Pss) addFwdCache(msg *PssMsg) error {
|
func (self *Pss) addFwdCache(msg *PssMsg) error {
|
||||||
var entry pssCacheEntry
|
var entry pssCacheEntry
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue