congestion control: stage 4

This commit is contained in:
skywind3000
2026-05-14 11:01:20 +08:00
parent 0d9515a42a
commit 8b32a64326

9
ikcp.c
View File

@@ -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;
}