| 200 | AvrgRTT = AvrgRTT * rttMixRate + RTT * (1 - rttMixRate); |
| 201 | } |
| 202 | void Success() { |
| 203 | PacketsInFly -= 1; |
| 204 | Y_ASSERT(PacketsInFly >= 0); |
| 205 | // FullSpeed should be correct at this point |
| 206 | // we assume that after UpdateAlive() we send all packets first then we listen for acks and call Success() |
| 207 | // FullSpeed is set in CanSend() during send if we are using full window |
| 208 | // do not increaese window while send rate is limited by virtual packets (ie start of transfer) |
| 209 | if (FullSpeed && VirtualPackets == 0) { |
| 210 | // there are 2 requirements for window growth |
| 211 | // 1) growth should be proportional to window size to ensure constant FailRate |
| 212 | // 2) growth should be constant to ensure fairness among different flows |
| 213 | // so lets make it square root :) |
| 214 | Window += sqrt(Window / CONG_CTRL_CHANNEL_INFLATE) * CONG_CTRL_WINDOW_GROW; |
| 215 | if (UseTOSforAcks) { |
| 216 | Window = Min(Window, MaxWindow); |
| 217 | } |
| 218 | } |
| 219 | FailRate *= 0.99f; |
| 220 | } |
| 221 | void FailureOnSend() { |
| 222 | //printf("Failure on send\n"); |
| 223 | PacketsInFly -= 1; |