提交 e8ec8ce9 作者: Brian Tiger Chow

Merge pull request #219 from jbenet/revert-218-fix/2014-10-29-mux-rwmutex

Revert "perf(mux) use RWMutex"
......@@ -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
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论