mirror of
https://github.com/skywind3000/kcp.git
synced 2025-03-22 07:22:59 +08:00
update ssthresh const name
IKCP_THRESH to IKCP_SSTHRESH, it seems better; like free and delete; ikcp_release, assert seems not necessary;
This commit is contained in:
parent
f74accebc2
commit
12e85d65ba
15
ikcp.c
15
ikcp.c
@ -39,8 +39,8 @@ const IUINT32 IKCP_ACK_FAST = 3;
|
|||||||
const IUINT32 IKCP_INTERVAL = 100;
|
const IUINT32 IKCP_INTERVAL = 100;
|
||||||
const IUINT32 IKCP_OVERHEAD = 24;
|
const IUINT32 IKCP_OVERHEAD = 24;
|
||||||
const IUINT32 IKCP_DEADLINK = 20;
|
const IUINT32 IKCP_DEADLINK = 20;
|
||||||
const IUINT32 IKCP_THRESH_INIT = 2;
|
const IUINT32 IKCP_SSTHRESH_INIT = 2; // slow start threshold
|
||||||
const IUINT32 IKCP_THRESH_MIN = 2;
|
const IUINT32 IKCP_SSTHRESH_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
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ ikcpcb* ikcp_create(IUINT32 conv, void *user)
|
|||||||
kcp->nodelay = 0;
|
kcp->nodelay = 0;
|
||||||
kcp->updated = 0;
|
kcp->updated = 0;
|
||||||
kcp->logmask = 0;
|
kcp->logmask = 0;
|
||||||
kcp->ssthresh = IKCP_THRESH_INIT;
|
kcp->ssthresh = IKCP_SSTHRESH_INIT;
|
||||||
kcp->fastresend = 0;
|
kcp->fastresend = 0;
|
||||||
kcp->nocwnd = 0;
|
kcp->nocwnd = 0;
|
||||||
kcp->xmit = 0;
|
kcp->xmit = 0;
|
||||||
@ -298,7 +298,6 @@ ikcpcb* ikcp_create(IUINT32 conv, void *user)
|
|||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
void ikcp_release(ikcpcb *kcp)
|
void ikcp_release(ikcpcb *kcp)
|
||||||
{
|
{
|
||||||
assert(kcp);
|
|
||||||
if (kcp) {
|
if (kcp) {
|
||||||
IKCPSEG *seg;
|
IKCPSEG *seg;
|
||||||
while (!iqueue_is_empty(&kcp->snd_buf)) {
|
while (!iqueue_is_empty(&kcp->snd_buf)) {
|
||||||
@ -1092,16 +1091,16 @@ void ikcp_flush(ikcpcb *kcp)
|
|||||||
if (change) {
|
if (change) {
|
||||||
IUINT32 inflight = kcp->snd_nxt - kcp->snd_una;
|
IUINT32 inflight = kcp->snd_nxt - kcp->snd_una;
|
||||||
kcp->ssthresh = inflight / 2;
|
kcp->ssthresh = inflight / 2;
|
||||||
if (kcp->ssthresh < IKCP_THRESH_MIN)
|
if (kcp->ssthresh < IKCP_SSTHRESH_MIN)
|
||||||
kcp->ssthresh = IKCP_THRESH_MIN;
|
kcp->ssthresh = IKCP_SSTHRESH_MIN;
|
||||||
kcp->cwnd = kcp->ssthresh + resent;
|
kcp->cwnd = kcp->ssthresh + resent;
|
||||||
kcp->incr = kcp->cwnd * kcp->mss;
|
kcp->incr = kcp->cwnd * kcp->mss;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lost) {
|
if (lost) {
|
||||||
kcp->ssthresh = cwnd / 2;
|
kcp->ssthresh = cwnd / 2;
|
||||||
if (kcp->ssthresh < IKCP_THRESH_MIN)
|
if (kcp->ssthresh < IKCP_SSTHRESH_MIN)
|
||||||
kcp->ssthresh = IKCP_THRESH_MIN;
|
kcp->ssthresh = IKCP_SSTHRESH_MIN;
|
||||||
kcp->cwnd = 1;
|
kcp->cwnd = 1;
|
||||||
kcp->incr = kcp->mss;
|
kcp->incr = kcp->mss;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user