Skip to content

Commit ed2d05a

Browse files
committed
Fix copyPacketWaitWithPool
1 parent a23ffba commit ed2d05a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

common/bufio/copy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func CopyExtended(originDestination io.Writer, destination N.ExtendedWriter, sou
7171
return
7272
}
7373
}
74-
if N.IsUnsafeWriter(destination) {
74+
if !common.UnsafeBuffer || N.IsUnsafeWriter(destination) {
7575
return CopyExtendedWithPool(originDestination, destination, source, readCounters, writeCounters)
7676
}
7777
bufferSize := N.CalculateMTU(source, destination)

common/bufio/copy_direct_posix.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ func copyPacketWaitWithPool(destinationConn N.PacketWriter, source N.PacketReadW
113113
if err != nil {
114114
buffer.Release()
115115
return
116+
} else {
117+
buffer = nil
116118
}
117119
n += int64(dataLen)
118120
for _, counter := range readCounters {

0 commit comments

Comments
 (0)