From 3323952401a9a437e019ab2bd0fe68d1340336f2 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Mon, 27 Oct 2014 21:12:03 -0700 Subject: [PATCH] Revert "perf(mux) use RWMutex" --- net/mux/mux.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/mux/mux.go b/net/mux/mux.go index 37856725d..a8865bb73 100644 --- a/net/mux/mux.go +++ b/net/mux/mux.go @@ -41,10 +41,10 @@ type Muxer struct { // Protocols are the multiplexed services. Protocols ProtocolMap - bwiLock sync.RWMutex + bwiLock sync.Mutex bwIn uint64 - bwoLock sync.RWMutex + bwoLock sync.Mutex bwOut uint64 *msg.Pipe @@ -76,13 +76,13 @@ func (m *Muxer) GetPipe() *msg.Pipe { // GetBandwidthTotals return the in/out bandwidth measured over this muxer. func (m *Muxer) GetBandwidthTotals() (in uint64, out uint64) { - m.bwiLock.RLock() + m.bwiLock.Lock() in = m.bwIn - m.bwiLock.RUnlock() + m.bwiLock.Unlock() - m.bwoLock.RLock() + m.bwoLock.Lock() out = m.bwOut - m.bwoLock.RUnlock() + m.bwoLock.Unlock() return }