mirror of
https://github.com/skywind3000/kcp.git
synced 2024-12-25 22:50:09 +08:00
new: IKCP_FASTACK_LIMIT
This commit is contained in:
parent
3a9196b1b7
commit
a5d82ca1cb
15
ikcp.c
15
ikcp.c
@ -43,6 +43,7 @@ const IUINT32 IKCP_THRESH_INIT = 2;
|
|||||||
const IUINT32 IKCP_THRESH_MIN = 2;
|
const IUINT32 IKCP_THRESH_MIN = 2;
|
||||||
const IUINT32 IKCP_PROBE_INIT = 7000; // 7 secs to probe window size
|
const IUINT32 IKCP_PROBE_INIT = 7000; // 7 secs to probe window size
|
||||||
const IUINT32 IKCP_PROBE_LIMIT = 120000; // up to 120 secs to probe window
|
const IUINT32 IKCP_PROBE_LIMIT = 120000; // up to 120 secs to probe window
|
||||||
|
const IUINT32 IKCP_FASTACK_LIMIT = 5; // max times to trigger fastack
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
@ -283,6 +284,7 @@ ikcpcb* ikcp_create(IUINT32 conv, void *user)
|
|||||||
kcp->logmask = 0;
|
kcp->logmask = 0;
|
||||||
kcp->ssthresh = IKCP_THRESH_INIT;
|
kcp->ssthresh = IKCP_THRESH_INIT;
|
||||||
kcp->fastresend = 0;
|
kcp->fastresend = 0;
|
||||||
|
kcp->fastlimit = IKCP_FASTACK_LIMIT;
|
||||||
kcp->nocwnd = 0;
|
kcp->nocwnd = 0;
|
||||||
kcp->xmit = 0;
|
kcp->xmit = 0;
|
||||||
kcp->dead_link = IKCP_DEADLINK;
|
kcp->dead_link = IKCP_DEADLINK;
|
||||||
@ -1062,11 +1064,14 @@ void ikcp_flush(ikcpcb *kcp)
|
|||||||
lost = 1;
|
lost = 1;
|
||||||
}
|
}
|
||||||
else if (segment->fastack >= resent) {
|
else if (segment->fastack >= resent) {
|
||||||
needsend = 1;
|
if ((int)segment->xmit <= kcp->fastlimit ||
|
||||||
segment->xmit++;
|
kcp->fastlimit <= 0) {
|
||||||
segment->fastack = 0;
|
needsend = 1;
|
||||||
segment->resendts = current + segment->rto;
|
segment->xmit++;
|
||||||
change++;
|
segment->fastack = 0;
|
||||||
|
segment->resendts = current + segment->rto;
|
||||||
|
change++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needsend) {
|
if (needsend) {
|
||||||
|
1
ikcp.h
1
ikcp.h
@ -309,6 +309,7 @@ struct IKCPCB
|
|||||||
void *user;
|
void *user;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int fastresend;
|
int fastresend;
|
||||||
|
int fastlimit;
|
||||||
int nocwnd, stream;
|
int nocwnd, stream;
|
||||||
int logmask;
|
int logmask;
|
||||||
int (*output)(const char *buf, int len, struct IKCPCB *kcp, void *user);
|
int (*output)(const char *buf, int len, struct IKCPCB *kcp, void *user);
|
||||||
|
Loading…
Reference in New Issue
Block a user