From 8ee6b1f15c6a444ccfb9154b2a47627e7eb53d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=98=8E?= Date: Mon, 12 Dec 2016 18:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dikcp=5Fcheck=E8=BF=94?= =?UTF-8?q?=E5=9B=9Ecurrent,=20ikcp=5Fupate=E5=8F=AF=E8=83=BD=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E8=B0=83ikcp=5Fflush?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ikcp.c | 3 ++- ikcp.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ikcp.c b/ikcp.c index ef116900..3b3818f8 100644 --- a/ikcp.c +++ b/ikcp.c @@ -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; @@ -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; diff --git a/ikcp.h b/ikcp.h index c5f29a08..5024f9d9 100644 --- a/ikcp.h +++ b/ikcp.h @@ -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);