@cryptotaxi247 / kubo / commits / 1026244f1

fix(net/mux) rate-limit producers by handling outgoing message synchronously

License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Dec 2, 2014 at 01:14 UTC 1026244f13a1aa31fb7aa5d17bff57505ad087e7
1 file changed +1 -3
net/mux/mux.go
+1 -3
@@ -174,8 +174,7 @@ func (m *Muxer) handleOutgoingMessages(pid pb.ProtocolID, proto Protocol) {
174 if !more {
175 return
176 }
177 - m.Children().Add(1)
178 - go m.handleOutgoingMessage(pid, msg)
177 + m.handleOutgoingMessage(pid, msg)
178
179 case <-m.Closing():
180 return
@@ -185,7 +184,6 @@ func (m *Muxer) handleOutgoingMessages(pid pb.ProtocolID, proto Protocol) {
184
185 // handleOutgoingMessage wraps out a message and sends it out the
186 func (m *Muxer) handleOutgoingMessage(pid pb.ProtocolID, m1 msg.NetMessage) {
188 - defer m.Children().Done()
187
188 data, err := wrapData(m1.Data(), pid)
189 if err != nil {