From 8365dd48a17afdd1e7857092f60df6341ed14acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 1 May 2023 12:41:32 +0800 Subject: [PATCH] Fix write cached packets --- common/bufio/copy.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/bufio/copy.go b/common/bufio/copy.go index bc1b1d8..c27bc20 100644 --- a/common/bufio/copy.go +++ b/common/bufio/copy.go @@ -413,7 +413,6 @@ func CopyPacketWithPool(destinationConn N.PacketWriter, source N.PacketReader, r func WritePacketWithPool(destinationConn N.PacketWriter, packetBuffers []*N.PacketBuffer) (n int64, err error) { frontHeadroom := N.CalculateFrontHeadroom(destinationConn) rearHeadroom := N.CalculateRearHeadroom(destinationConn) - var destination M.Socksaddr for _, packetBuffer := range packetBuffers { buffer := buf.NewPacket() readBufferRaw := buffer.Slice() @@ -426,7 +425,7 @@ func WritePacketWithPool(destinationConn N.PacketWriter, packetBuffers []*N.Pack } dataLen := readBuffer.Len() buffer.Resize(readBuffer.Start(), dataLen) - err = destinationConn.WritePacket(buffer, destination) + err = destinationConn.WritePacket(buffer, packetBuffer.Destination) if err != nil { buffer.Release() return