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

Method Ack

library/cpp/netliba/v12/net_acks.cpp:124–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 }
123
124 void TAckTracker::Ack(int pkt, float deltaT, bool updateRTT) {
125 Y_ASSERT(0 <= pkt && pkt < PacketCount);
126
127 if (AckReceived[pkt]) {
128 DroppedPackets.erase(pkt);
129 if (PacketsInFly.erase(pkt) == 0) {
130 EraseFromResend(pkt);
131 }
132 return;
133 }
134
135 AckReceived[pkt] = true;
136
137 //printf("Ack received for %d\n", pkt);
138 TPacketHash::iterator i = PacketsInFly.find(pkt);
139 if (i == PacketsInFly.end()) {
140 EraseFromResend(pkt);
141
142 TPacketHash::iterator z = DroppedPackets.find(pkt);
143 if (z != DroppedPackets.end()) {
144 // late packet arrived
145 if (updateRTT) {
146 float ping = z->second + deltaT;
147 Congestion->RegisterRTT(ping);
148 }
149 DroppedPackets.erase(z);
150 } else {
151 // may oocur after connection reset - we drop all information about sends even about those which reached new instance
152 // but this is a correct ACK - we just forgot that we sent it
153 //Y_ASSERT(0);
154 }
155 return;
156 }
157
158 if (updateRTT) {
159 float ping = i->second + deltaT;
160 //printf("Register RTT %g\n", ping * 1000);
161 Congestion->RegisterRTT(ping);
162 }
163 PacketsInFly.erase(i);
164 Congestion->Success();
165 }
166
167 void TAckTracker::AckAll() {
168 for (TPacketHash::const_iterator i = PacketsInFly.begin(); i != PacketsInFly.end(); ++i) {

Callers 2

ProcessAcksPacketMethod · 0.45
AckPacketFunction · 0.45

Calls 5

eraseMethod · 0.45
findMethod · 0.45
endMethod · 0.45
RegisterRTTMethod · 0.45
SuccessMethod · 0.45

Tested by

no test coverage detected