new comment

This commit is contained in:
skywind3000 2014-12-30 10:48:21 +08:00
parent a6a8a790f6
commit c5a877d2aa
2 changed files with 12 additions and 2 deletions

10
ikcp.c
View File

@ -1072,6 +1072,16 @@ void ikcp_update(ikcpcb *kcp, IUINT32 current)
} }
//---------------------------------------------------------------------
// Determine when should you invoke ikcp_update:
// if there is no ikcp_input/_send calling, you can call ikcp_update
// after millisecs ikcp_check returns, instead of call update repeatly.
// It is important to reduce unnacessary ikcp_update calling. you can
// just call ikcp_update in a very small interval, or you can use it to
// schedule ikcp_update calling (eg. when you are 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(const ikcpcb *kcp, IUINT32 current)
{ {
IUINT32 ts_flush = kcp->ts_flush; IUINT32 ts_flush = kcp->ts_flush;

4
ikcp.h
View File

@ -347,11 +347,11 @@ int ikcp_send(ikcpcb *kcp, const char *buffer, int len);
void ikcp_update(ikcpcb *kcp, IUINT32 current); void ikcp_update(ikcpcb *kcp, IUINT32 current);
// Determine when should you invoke ikcp_update: // Determine when should you invoke ikcp_update:
// if there is no incoming low level packet, you can invoke ikcp_update // if there is no ikcp_input/_send calling, you can call ikcp_update
// after millisecs ikcp_check returns, instead of call update repeatly. // after millisecs ikcp_check returns, instead of call update repeatly.
// It is important to reduce unnacessary ikcp_update calling. you can // It is important to reduce unnacessary ikcp_update calling. you can
// just call ikcp_update in a very small interval, or you can use it to // just call ikcp_update in a very small interval, or you can use it to
// schedule ikcp_update invoking (eg. when you are implementing an epoll // schedule ikcp_update calling (eg. when you are implementing an epoll
// like mechanism, or optimize ikcp_update when handling massive kcp // like mechanism, or optimize ikcp_update when handling massive kcp
// connections) // connections)
IUINT32 ikcp_check(const ikcpcb *kcp, IUINT32 current); IUINT32 ikcp_check(const ikcpcb *kcp, IUINT32 current);