mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 19:24:14 +08:00
fix(net/mux) rate-limit producers by handling outgoing message synchronously
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit is contained in:
@ -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
|
||||
@ -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 {
|
||||
|
Reference in New Issue
Block a user