| 58 | } |
| 59 | |
| 60 | int TAckTracker::SelectPacket() { |
| 61 | if (!ResendQueue.empty()) { |
| 62 | int res = ResendQueue.back(); |
| 63 | ResendQueue.pop_back(); |
| 64 | if (AckReceived[res]) { |
| 65 | fprintf(stderr, "resending packet %d, but ack already received\n", res); |
| 66 | } |
| 67 | return res; |
| 68 | } |
| 69 | if (CurrentPacket == PacketCount) { |
| 70 | return -1; |
| 71 | } |
| 72 | return CurrentPacket++; |
| 73 | } |
| 74 | |
| 75 | TAckTracker::~TAckTracker() { |
| 76 | for (TPacketHash::const_iterator i = PacketsInFly.begin(); i != PacketsInFly.end(); ++i) |