Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions event/kcp/hkcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ int hio_read_kcp (hio_t* io, void* buf, int readbytes) {
while (1) {
int nrecv = ikcp_recv(kcp->ikcp, kcp->readbuf.base, kcp->readbuf.len);
// printf("ikcp_recv nrecv=%d\n", nrecv);
if (nrecv == -3) { // drop packet when larger than readbuf.len
int peeksize = ikcp_peeksize(kcp->ikcp);
ikcp_recv(kcp->ikcp, NULL, peeksize);
nrecv = 0;
}
if (nrecv < 0) break;
hio_read_cb(io, kcp->readbuf.base, nrecv);
ret += nrecv;
Expand Down