mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
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:
@@ -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.
|
// write runs in a goroutine and writes packets to conn using a buffer from the writeBufferPool, or a new buffer.
|
||||||
func (m *multiplexer) goWrite() {
|
func (m *multiplexer) goWrite() {
|
||||||
buf := make([]byte, m.maxPacketSize)
|
|
||||||
for pkt := range m.pktOut {
|
for pkt := range m.pktOut {
|
||||||
|
buf := make([]byte, m.maxPacketSize)
|
||||||
plen, err := pkt.WriteTo(buf) // encode
|
plen, err := pkt.WriteTo(buf) // encode
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: handle write error
|
// TODO: handle write error
|
||||||
|
|||||||
Reference in New Issue
Block a user