mirror of
https://github.com/skywind3000/kcp.git
synced 2026-08-19 06:03:28 +08:00
congestion control: definitions
This commit is contained in:
29
ikcp.h
29
ikcp.h
@@ -342,6 +342,8 @@ struct IKCPCB
|
||||
int fastresend;
|
||||
int fastlimit;
|
||||
int nocwnd, stream;
|
||||
const struct IKCPOPS *ccops;
|
||||
void *congest;
|
||||
int logmask;
|
||||
int (*output)(const char *buf, int len, struct IKCPCB *kcp, void *user);
|
||||
void (*writelog)(const char *log, struct IKCPCB *kcp, void *user);
|
||||
@@ -369,9 +371,9 @@ extern "C" {
|
||||
// interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
// create a new kcp control object, 'conv' must equal in two endpoint
|
||||
// from the same connection. 'user' will be passed to the output callback
|
||||
// output callback can be setup like this: 'kcp->output = my_udp_output'
|
||||
// create a new kcp control object, 'conv' must be equal in both endpoints
|
||||
// of the same connection. 'user' will be passed to the output callback.
|
||||
// output callback can be set up like this: 'kcp->output = my_udp_output'
|
||||
ikcpcb* ikcp_create(IUINT32 conv, void *user);
|
||||
|
||||
// release kcp control object
|
||||
@@ -392,16 +394,16 @@ int ikcp_send(ikcpcb *kcp, const char *buffer, int len);
|
||||
// 'current' - current timestamp in millisec.
|
||||
void ikcp_update(ikcpcb *kcp, IUINT32 current);
|
||||
|
||||
// Determine when should you invoke ikcp_update:
|
||||
// returns when you should invoke ikcp_update in millisec, if there
|
||||
// is no ikcp_input/_send calling. you can call ikcp_update in that
|
||||
// time, instead of call update repeatly.
|
||||
// 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)
|
||||
// Determines when you should invoke ikcp_update next:
|
||||
// returns the timestamp (in milliseconds) at which you should call
|
||||
// ikcp_update, assuming no ikcp_input/_send calls occur in between.
|
||||
// You can call ikcp_update at that time instead of calling it repeatedly.
|
||||
// Important for reducing unnecessary ikcp_update invocations. Use it to
|
||||
// schedule ikcp_update (e.g., implementing an epoll-like mechanism,
|
||||
// or optimizing ikcp_update when handling massive kcp connections).
|
||||
IUINT32 ikcp_check(const ikcpcb *kcp, IUINT32 current);
|
||||
|
||||
// when you received a low level packet (eg. UDP packet), call it
|
||||
// when you receive a low-level packet (e.g., UDP packet), call this
|
||||
int ikcp_input(ikcpcb *kcp, const char *data, long size);
|
||||
|
||||
// flush pending data
|
||||
@@ -416,7 +418,7 @@ int ikcp_setmtu(ikcpcb *kcp, int mtu);
|
||||
// set maximum window size: sndwnd=32, rcvwnd=32 by default
|
||||
int ikcp_wndsize(ikcpcb *kcp, int sndwnd, int rcvwnd);
|
||||
|
||||
// get how many packet is waiting to be sent
|
||||
// get how many packets are waiting to be sent
|
||||
int ikcp_waitsnd(const ikcpcb *kcp);
|
||||
|
||||
// fastest: ikcp_nodelay(kcp, 1, 20, 2, 1)
|
||||
@@ -426,7 +428,10 @@ int ikcp_waitsnd(const ikcpcb *kcp);
|
||||
// nc: 0:normal congestion control(default), 1:disable congestion control
|
||||
int ikcp_nodelay(ikcpcb *kcp, int nodelay, int interval, int resend, int nc);
|
||||
|
||||
// install congestion control algorithm, NULL restores builtin
|
||||
int ikcp_setcc(ikcpcb *kcp, const struct IKCPOPS *ops);
|
||||
|
||||
// write log with kcp->writelog
|
||||
void ikcp_log(ikcpcb *kcp, int mask, const char *fmt, ...);
|
||||
|
||||
// setup allocator
|
||||
|
||||
Reference in New Issue
Block a user