aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/server.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-15 09:12:14 +0800
committerobscuren <geffobscura@gmail.com>2015-02-15 09:13:24 +0800
commit09e53367a24025564686af42c8349d2bd05729c3 (patch)
tree13895b4f838afe5c04d87149cc79d54006f2e32b /p2p/server.go
parentb143dad596f4230d74dadd3c5060020bd50ef7f3 (diff)
downloaddexon-09e53367a24025564686af42c8349d2bd05729c3.tar
dexon-09e53367a24025564686af42c8349d2bd05729c3.tar.gz
dexon-09e53367a24025564686af42c8349d2bd05729c3.tar.bz2
dexon-09e53367a24025564686af42c8349d2bd05729c3.tar.lz
dexon-09e53367a24025564686af42c8349d2bd05729c3.tar.xz
dexon-09e53367a24025564686af42c8349d2bd05729c3.tar.zst
dexon-09e53367a24025564686af42c8349d2bd05729c3.zip
Use a mutex write-lock for a write operation
Diffstat (limited to 'p2p/server.go')
-rw-r--r--p2p/server.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/p2p/server.go b/p2p/server.go
index e510be521..35b584a27 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -436,15 +436,15 @@ func (self *BlacklistMap) Exists(pubkey []byte) (ok bool) {
}
func (self *BlacklistMap) Put(pubkey []byte) error {
- self.lock.RLock()
- defer self.lock.RUnlock()
+ self.lock.Lock()
+ defer self.lock.Unlock()
self.blacklist[string(pubkey)] = true
return nil
}
func (self *BlacklistMap) Delete(pubkey []byte) error {
- self.lock.RLock()
- defer self.lock.RUnlock()
+ self.lock.Lock()
+ defer self.lock.Unlock()
delete(self.blacklist, string(pubkey))
return nil
}