Reorderer::Reorderer(Sender* sender)
: sender(sender), last_seq(-1)
{
+ gettimeofday(&last_sent_packet, NULL);
}
void Reorderer::send_packet(uint16_t proto, const string& data, int seq)
// in case there are more timeouts.
}
+ // In case of restarts.
+ if (packet_buffer.empty() &&
+ seq < last_seq &&
+ tdiff(last_sent_packet, now) > 5.0) {
+ printf("No good data for five seconds, resetting sequence to %d\n", seq);
+ last_seq = seq - 1;
+ }
+
GREPacket packet;
packet.seq = seq;
packet.proto = proto;
sender->send_packet(proto, data, seq);
packet_buffer.pop();
last_seq = front_seq;
+ last_sent_packet = now;
if (!silence && !packet_buffer.empty()) {
printf("Reordering with packet buffer size %d: seq=%d new_front_seq=%d\n", int(packet_buffer.size()), front_seq, packet_buffer.top().seq);
silence = true;
Sender* sender;
int last_seq;
+ timeval last_sent_packet;
std::priority_queue<GREPacket, std::vector<GREPacket>, std::greater<GREPacket>> packet_buffer;
std::map<int, int> ccs;