mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 04:47:40 +03:00
Fix write cached packets
This commit is contained in:
parent
7662278795
commit
8365dd48a1
1 changed files with 1 additions and 2 deletions
|
@ -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) {
|
func WritePacketWithPool(destinationConn N.PacketWriter, packetBuffers []*N.PacketBuffer) (n int64, err error) {
|
||||||
frontHeadroom := N.CalculateFrontHeadroom(destinationConn)
|
frontHeadroom := N.CalculateFrontHeadroom(destinationConn)
|
||||||
rearHeadroom := N.CalculateRearHeadroom(destinationConn)
|
rearHeadroom := N.CalculateRearHeadroom(destinationConn)
|
||||||
var destination M.Socksaddr
|
|
||||||
for _, packetBuffer := range packetBuffers {
|
for _, packetBuffer := range packetBuffers {
|
||||||
buffer := buf.NewPacket()
|
buffer := buf.NewPacket()
|
||||||
readBufferRaw := buffer.Slice()
|
readBufferRaw := buffer.Slice()
|
||||||
|
@ -426,7 +425,7 @@ func WritePacketWithPool(destinationConn N.PacketWriter, packetBuffers []*N.Pack
|
||||||
}
|
}
|
||||||
dataLen := readBuffer.Len()
|
dataLen := readBuffer.Len()
|
||||||
buffer.Resize(readBuffer.Start(), dataLen)
|
buffer.Resize(readBuffer.Start(), dataLen)
|
||||||
err = destinationConn.WritePacket(buffer, destination)
|
err = destinationConn.WritePacket(buffer, packetBuffer.Destination)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
buffer.Release()
|
buffer.Release()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue