internal override void OnACK_UpdateWindow(RUDPOutgoingPacket packet) { //---- Reset _outOfOrderCount = 0; //---- Check the phase if (CWND <= _ssthresh) Phase = Phase.SlowStart; else Phase = Phase.CongestionAvoidance; //---- Slow start if (Phase == Phase.SlowStart) { // Exponential grow CWND += _rudp.MTU; } //---- Congestion avoidance if (Phase == Phase.CongestionAvoidance) { // (increase of 1 packet every RTT) // This is a linear growth of cwnd. CWND += (_rudp.MTU * _rudp.MTU) / CWND; } //---- Check boundaries CWND = Math.Max(Math.Min(_awnd, _cwnd), _rudp._mtu); //---- Update slow start threshold if (_ssthresh < CWND) _ssthresh = Math.Min(64 * 1024, CWND); }
internal override void OnACK_UpdateWindow(RUDPOutgoingPacket packet) { if (CWND < low_window) { CWND = CWND + _rudp.MTU / CWND; // normal TCP = (1 packet/cwnd) return; } if (!is_BITCP_ss) { // bin. increase if ((target_win - CWND) < Smax) // bin. search { CWND += (target_win - CWND) / CWND; } else { CWND += Smax / CWND; // additive incre. } if (max_win > CWND) { min_win = CWND; target_win = (max_win + min_win) / 2; } else { is_BITCP_ss = true; ss_cwnd = 1; ss_target = CWND + 1; max_win = default_max_win; } } else { // slow start CWND = CWND + ss_cwnd / CWND; if (CWND >= ss_target) { ss_cwnd = 2.0 * ss_cwnd; ss_target = CWND + ss_cwnd; } if (ss_cwnd >= Smax) { is_BITCP_ss = false; } } }
internal override void OnACK_UpdateWindow(RUDPOutgoingPacket packet) { delay_min = Math.Min(_rudp._rtt, delay_min); if (CWND < ssthresh) { CWND++; //slow start } else { if (epoch_start == 0) { epoch_start = HiResTimer.MicroSeconds; K = Math.Max(0, Math.Pow(b * (last_max - CWND), 1.0 / 3)); origin_point = Math.Max(CWND, last_max); } t = HiResTimer.MicroSeconds + delay_min - epoch_start; target = origin_point + c * Math.Pow(t - K, 1.0 / 3); if (target > CWND) { cnt = CWND / (target - CWND); } else { cnt = 100 * CWND; } if (delay_min > 0) { cnt = Math.Max(cnt, 8 * CWND / (20 * delay_min)); //max AI rate } if (loss_cwnd == 0) { cnt = 50; // continue exponential increase before first backoff } if (cwnd_cnt > cnt) { CWND++; cwnd_cnt = 0; } else { cwnd_cnt++; } } }
internal override void OnACK_UpdateWindow(RUDPOutgoingPacket packet) { if (CWND < low_window) { CWND = CWND + _rudp.MTU / CWND; // normal TCP = (1 packet/cwnd) return; } if (!is_BITCP_ss) { // bin. increase if ((target_win - CWND) < Smax) // bin. search CWND += (target_win - CWND) / CWND; else CWND += Smax / CWND; // additive incre. if (max_win > CWND) { min_win = CWND; target_win = (max_win + min_win) / 2; } else { is_BITCP_ss = true; ss_cwnd = 1; ss_target = CWND + 1; max_win = default_max_win; } } else { // slow start CWND = CWND + ss_cwnd / CWND; if (CWND >= ss_target) { ss_cwnd = 2.0 * ss_cwnd; ss_target = CWND + ss_cwnd; } if (ss_cwnd >= Smax) is_BITCP_ss = false; } }
internal override void OnACK_UpdateWindow(RUDPOutgoingPacket packet) { //---- Reset _outOfOrderCount = 0; //---- Check the phase if (CWND <= _ssthresh) { Phase = Phase.SlowStart; } else { Phase = Phase.CongestionAvoidance; } //---- Slow start if (Phase == Phase.SlowStart) { // Exponential grow CWND += _rudp.MTU; } //---- Congestion avoidance if (Phase == Phase.CongestionAvoidance) { // (increase of 1 packet every RTT) // This is a linear growth of cwnd. CWND += (_rudp.MTU * _rudp.MTU) / CWND; } //---- Check boundaries CWND = Math.Max(Math.Min(_awnd, _cwnd), _rudp._mtu); //---- Update slow start threshold if (_ssthresh < CWND) { _ssthresh = Math.Min(64 * 1024, CWND); } }
internal override void OnACK_UpdateWindow(RUDPOutgoingPacket packet) { delay_min = Math.Min(_rudp._rtt, delay_min); if (CWND < ssthresh) CWND++; //slow start else { if (epoch_start == 0) { epoch_start = HiResTimer.MicroSeconds; K = Math.Max(0, Math.Pow(b * (last_max - CWND), 1.0 / 3)); origin_point = Math.Max(CWND, last_max); } t = HiResTimer.MicroSeconds + delay_min - epoch_start; target = origin_point + c * Math.Pow(t - K, 1.0 / 3); if (target > CWND) cnt = CWND / (target - CWND); else cnt = 100 * CWND; if (delay_min > 0) cnt = Math.Max(cnt, 8 * CWND / (20 * delay_min)); //max AI rate if (loss_cwnd == 0) cnt = 50; // continue exponential increase before first backoff if (cwnd_cnt > cnt) { CWND++; cwnd_cnt = 0; } else cwnd_cnt++; } }