This commit is contained in:
XiongMing 2024-12-02 03:24:48 +00:00 committed by GitHub
commit 7e88bf5d70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

3
ikcp.c
View File

@ -1187,7 +1187,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;
@ -1214,6 +1214,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;

2
ikcp.h
View File

@ -370,7 +370,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);