mirror of
https://github.com/skywind3000/kcp.git
synced 2026-08-22 07:33:28 +08:00
congestion control: stage 4
This commit is contained in:
9
ikcp.c
9
ikcp.c
@@ -777,6 +777,8 @@ void ikcp_parse_data(ikcpcb *kcp, IKCPSEG *newseg)
|
||||
int ikcp_input(ikcpcb *kcp, const char *data, long size)
|
||||
{
|
||||
IUINT32 prev_una = kcp->snd_una;
|
||||
IUINT32 prev_nsnd_buf = kcp->nsnd_buf;
|
||||
IUINT32 acked_segs, prior_in_flight;
|
||||
IUINT32 maxack = 0, latest_ts = 0;
|
||||
int flag = 0;
|
||||
|
||||
@@ -901,6 +903,12 @@ int ikcp_input(ikcpcb *kcp, const char *data, long size)
|
||||
}
|
||||
|
||||
if (_itimediff(kcp->snd_una, prev_una) > 0) {
|
||||
acked_segs = kcp->snd_una - prev_una;
|
||||
prior_in_flight = prev_nsnd_buf;
|
||||
if (kcp->ccops && kcp->ccops->on_ack) {
|
||||
kcp->ccops->on_ack(kcp, acked_segs, prior_in_flight);
|
||||
}
|
||||
else {
|
||||
if (kcp->cwnd < kcp->rmt_wnd) {
|
||||
IUINT32 mss = kcp->mss;
|
||||
if (kcp->cwnd < kcp->ssthresh) {
|
||||
@@ -923,6 +931,7 @@ int ikcp_input(ikcpcb *kcp, const char *data, long size)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user