Skip to content

Commit

Permalink
bugfix in empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Mar 21, 2019
1 parent 44234c0 commit bcef39b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ func (kcp *KCP) flush(ackOnly bool) uint32 {

if ackOnly { // flash remain ack segments
size := len(buffer) - len(ptr)
if size > 0 {
if size > kcp.keep {
kcp.output(buffer, size)
}
return kcp.interval
Expand Down
2 changes: 1 addition & 1 deletion sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func newUDPSession(conv uint32, dataShards, parityShards int, l *Listener, conn
}

sess.kcp = NewKCP(conv, func(buf []byte, size int) {
if size >= IKCP_OVERHEAD {
if size >= IKCP_OVERHEAD+sess.headerSize {
sess.output(buf[:size])
}
})
Expand Down

0 comments on commit bcef39b

Please sign in to comment.