diff --git a/transport/internet/kcp/connection.go b/transport/internet/kcp/connection.go index 033698dc..1987b1ea 100644 --- a/transport/internet/kcp/connection.go +++ b/transport/internet/kcp/connection.go @@ -398,8 +398,10 @@ func (c *Connection) WriteMultiBuffer(mb buf.MultiBuffer) error { return io.ErrClosedPipe } + mbPtr := &mb + if !c.sendingWorker.Push(func(bb []byte) (int, error) { - return mb.Read(bb[:c.mss]) + return mbPtr.Read(bb[:c.mss]) }) { break }