Skip to content

Commit bcef39b

Browse files
committed
bugfix in empty data
1 parent 44234c0 commit bcef39b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ func (kcp *KCP) flush(ackOnly bool) uint32 {
669669

670670
if ackOnly { // flash remain ack segments
671671
size := len(buffer) - len(ptr)
672-
if size > 0 {
672+
if size > kcp.keep {
673673
kcp.output(buffer, size)
674674
}
675675
return kcp.interval

sess.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func newUDPSession(conv uint32, dataShards, parityShards int, l *Listener, conn
142142
}
143143

144144
sess.kcp = NewKCP(conv, func(buf []byte, size int) {
145-
if size >= IKCP_OVERHEAD {
145+
if size >= IKCP_OVERHEAD+sess.headerSize {
146146
sess.output(buf[:size])
147147
}
148148
})

0 commit comments

Comments
 (0)