@cryptotaxi247 / kubo / commits / 332395240

Revert "perf(mux) use RWMutex"

Brian Tiger Chow committed Oct 27, 2014 at 21:12 UTC 3323952401a9a437e019ab2bd0fe68d1340336f2
1 file changed +6 -6
net/mux/mux.go
+6 -6
@@ -41,10 +41,10 @@ type Muxer struct {
41 // Protocols are the multiplexed services.
42 Protocols ProtocolMap
43
44 - bwiLock sync.RWMutex
44 + bwiLock sync.Mutex
45 bwIn uint64
46
47 - bwoLock sync.RWMutex
47 + bwoLock sync.Mutex
48 bwOut uint64
49
50 *msg.Pipe
@@ -76,13 +76,13 @@ func (m *Muxer) GetPipe() *msg.Pipe {
76
77 // GetBandwidthTotals return the in/out bandwidth measured over this muxer.
78 func (m *Muxer) GetBandwidthTotals() (in uint64, out uint64) {
79 - m.bwiLock.RLock()
79 + m.bwiLock.Lock()
80 in = m.bwIn
81 - m.bwiLock.RUnlock()
81 + m.bwiLock.Unlock()
82
83 - m.bwoLock.RLock()
83 + m.bwoLock.Lock()
84 out = m.bwOut
85 - m.bwoLock.RUnlock()
85 + m.bwoLock.Unlock()
86 return
87 }
88