From 1ec20e63866d609ff86f426e62e4462014c44232 Mon Sep 17 00:00:00 2001 From: Kleissner Date: Mon, 25 Oct 2021 07:56:35 +0200 Subject: [PATCH] UDT: Fix critical bug in multiplexer.goWrite. It was overwriting packets on the fly. A new buffer is needed for each outgoing packet. --- udt/multiplexer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udt/multiplexer.go b/udt/multiplexer.go index 598b54e..2157b6b 100644 --- a/udt/multiplexer.go +++ b/udt/multiplexer.go @@ -117,8 +117,8 @@ func (m *multiplexer) goRead() { // write runs in a goroutine and writes packets to conn using a buffer from the writeBufferPool, or a new buffer. func (m *multiplexer) goWrite() { - buf := make([]byte, m.maxPacketSize) for pkt := range m.pktOut { + buf := make([]byte, m.maxPacketSize) plen, err := pkt.WriteTo(buf) // encode if err != nil { // TODO: handle write error