Skip to content

Commit

Permalink
fix(net/mux) rate-limit producers by handling outgoing message synchr…
Browse files Browse the repository at this point in the history
…onously

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
  • Loading branch information
Brian Tiger Chow committed Dec 6, 2014
1 parent 0f6b1bc commit 1026244
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/mux/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ func (m *Muxer) handleOutgoingMessages(pid pb.ProtocolID, proto Protocol) {
if !more {
return
}
m.Children().Add(1)
go m.handleOutgoingMessage(pid, msg)
m.handleOutgoingMessage(pid, msg)

case <-m.Closing():
return
Expand All @@ -185,7 +184,6 @@ func (m *Muxer) handleOutgoingMessages(pid pb.ProtocolID, proto Protocol) {

// handleOutgoingMessage wraps out a message and sends it out the
func (m *Muxer) handleOutgoingMessage(pid pb.ProtocolID, m1 msg.NetMessage) {
defer m.Children().Done()

data, err := wrapData(m1.Data(), pid)
if err != nil {
Expand Down

0 comments on commit 1026244

Please # to comment.