diff options
author | Ralph Caraveo III <deckarep@gmail.com> | 2018-07-16 15:54:19 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-07-16 15:54:19 +0800 |
commit | 5d30be412b0f9181cb007c8893ee583ee4319116 (patch) | |
tree | 4593b259665d22c552cc869f08317305119a99e0 /whisper/whisperv5/whisper.go | |
parent | eb7f901289dce3f9fe3341da8c0b938ea839f79d (diff) | |
download | dexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar dexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar.gz dexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar.bz2 dexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar.lz dexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar.xz dexon-5d30be412b0f9181cb007c8893ee583ee4319116.tar.zst dexon-5d30be412b0f9181cb007c8893ee583ee4319116.zip |
all: switch out defunct set library to different one (#16873)
* keystore, ethash, eth, miner, rpc, whisperv6: tech debt with now defunct set.
* whisperv5: swap out gopkg.in/fatih/set.v0 with supported set
Diffstat (limited to 'whisper/whisperv5/whisper.go')
-rw-r--r-- | whisper/whisperv5/whisper.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/whisper/whisperv5/whisper.go b/whisper/whisperv5/whisper.go index cec233cb0..5a2b25c9e 100644 --- a/whisper/whisperv5/whisper.go +++ b/whisper/whisperv5/whisper.go @@ -26,6 +26,7 @@ import ( "sync" "time" + mapset "github.com/deckarep/golang-set" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -34,7 +35,6 @@ import ( "github.com/syndtr/goleveldb/leveldb/errors" "golang.org/x/crypto/pbkdf2" "golang.org/x/sync/syncmap" - set "gopkg.in/fatih/set.v0" ) type Statistics struct { @@ -63,7 +63,7 @@ type Whisper struct { poolMu sync.RWMutex // Mutex to sync the message and expiration pools envelopes map[common.Hash]*Envelope // Pool of envelopes currently tracked by this node - expirations map[uint32]*set.SetNonTS // Message expiration pool + expirations map[uint32]mapset.Set // Message expiration pool peerMu sync.RWMutex // Mutex to sync the active peer set peers map[*Peer]struct{} // Set of currently active peers @@ -90,7 +90,7 @@ func New(cfg *Config) *Whisper { privateKeys: make(map[string]*ecdsa.PrivateKey), symKeys: make(map[string][]byte), envelopes: make(map[common.Hash]*Envelope), - expirations: make(map[uint32]*set.SetNonTS), + expirations: make(map[uint32]mapset.Set), peers: make(map[*Peer]struct{}), messageQueue: make(chan *Envelope, messageQueueLimit), p2pMsgQueue: make(chan *Envelope, messageQueueLimit), @@ -608,9 +608,9 @@ func (w *Whisper) add(envelope *Envelope) (bool, error) { if !alreadyCached { w.envelopes[hash] = envelope if w.expirations[envelope.Expiry] == nil { - w.expirations[envelope.Expiry] = set.NewNonTS() + w.expirations[envelope.Expiry] = mapset.NewThreadUnsafeSet() } - if !w.expirations[envelope.Expiry].Has(hash) { + if !w.expirations[envelope.Expiry].Contains(hash) { w.expirations[envelope.Expiry].Add(hash) } } |