MCPcopy Create free account
hub / github.com/catboost/catboost / Step

Method Step

library/cpp/netliba/v6/net_acks.cpp:153–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152
153 void TAckTracker::Step(float deltaT) {
154 float timeoutVal = Congestion->GetTimeout();
155
156 //static int n;
157 //if ((++n % 1024) == 0)
158 // printf("timeout = %g, window = %g, fail_rate %g, pkt_rate = %g\n", timeoutVal * 1000, Congestion->GetWindow(), Congestion->GetFailRate(), (1 - Congestion->GetFailRate()) * Congestion->GetWindow() / Congestion->GetRTT());
159
160 TimeToNextPacketTimeout = 1000;
161 // для окон меньше единицы мы кидаем рандом один раз за RTT на то, можно ли пускать пакет
162 // поэтому можно ждать максимум RTT, после этого надо кинуть новый random
163 if (Congestion->GetWindow() < 1)
164 TimeToNextPacketTimeout = Congestion->GetRTT();
165
166 for (auto& droppedPacket : DroppedPackets) {
167 float& t = droppedPacket.second;
168 t += deltaT;
169 }
170
171 for (TPacketHash::iterator i = PacketsInFly.begin(); i != PacketsInFly.end();) {
172 float& t = i->second;
173 t += deltaT;
174 if (t > timeoutVal) {
175 //printf("packet %d timed out (timeout = %g)\n", i->first, timeoutVal);
176 ResendQueue.push_back(i->first);
177 DroppedPackets[i->first] = i->second;
178 TPacketHash::iterator k = i++;
179 PacketsInFly.erase(k);
180 Congestion->Failure();
181 } else {
182 TimeToNextPacketTimeout = Min(TimeToNextPacketTimeout, timeoutVal - t);
183 ++i;
184 }
185 }
186 }
187
188 static std::atomic<ui32> netAckRndVal = (ui32)GetCycleCount();
189 ui32 NetAckRnd() {

Callers

nothing calls this directly

Calls 9

MinFunction · 0.50
GetTimeoutMethod · 0.45
GetWindowMethod · 0.45
GetRTTMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
eraseMethod · 0.45
FailureMethod · 0.45

Tested by

no test coverage detected