Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复ikcp_check返回current, ikcp_upate可能不会调ikcp_flush #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion ikcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ void ikcp_update(ikcpcb *kcp, IUINT32 current)
// schedule ikcp_update (eg. implementing an epoll-like mechanism,
// or optimize ikcp_update when handling massive kcp connections)
//---------------------------------------------------------------------
IUINT32 ikcp_check(const ikcpcb *kcp, IUINT32 current)
IUINT32 ikcp_check(ikcpcb *kcp, IUINT32 current)
{
IUINT32 ts_flush = kcp->ts_flush;
IINT32 tm_flush = 0x7fffffff;
Expand All @@ -1182,6 +1182,7 @@ IUINT32 ikcp_check(const ikcpcb *kcp, IUINT32 current)
const IKCPSEG *seg = iqueue_entry(p, const IKCPSEG, node);
IINT32 diff = _itimediff(seg->resendts, current);
if (diff <= 0) {
kcp->ts_flush = current;
return current;
}
if (diff < tm_packet) tm_packet = diff;
Expand Down
2 changes: 1 addition & 1 deletion ikcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void ikcp_update(ikcpcb *kcp, IUINT32 current);
// Important to reduce unnacessary ikcp_update invoking. use it to
// schedule ikcp_update (eg. implementing an epoll-like mechanism,
// or optimize ikcp_update when handling massive kcp connections)
IUINT32 ikcp_check(const ikcpcb *kcp, IUINT32 current);
IUINT32 ikcp_check(ikcpcb *kcp, IUINT32 current);

// when you received a low level packet (eg. UDP packet), call it
int ikcp_input(ikcpcb *kcp, const char *data, long size);
Expand Down