UDT: Fix critical bug in multiplexer.goWrite. It was overwriting packets on the fly. A new buffer is needed for each outgoing packet.

This commit is contained in:
Kleissner
2021-10-25 07:56:35 +02:00
parent a8592e9975
commit 1ec20e6386

View File

@@ -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