]> git.sesse.net Git - greproxy/blobdiff - reorderer.h
Timeout packets in the reordering buffer after 100 ms. Helps in situations with seque...
[greproxy] / reorderer.h
index 393e327f7dbe86053fb374fd9601720c3a9e8195..f58a9327673ac1850c67b8e5f4b91ae5d72eb1f4 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <assert.h>
 #include <stdint.h>
+#include <sys/time.h>
 
 #include <algorithm>
 #include <map>
@@ -16,22 +17,22 @@ struct GREPacket {
        int seq;
        uint16_t proto;
        std::string data;
+       timeval ts;
 
        bool operator> (const GREPacket &other) const {
                return seq > other.seq;
        }
 };
 
-class Reorderer : public Protocol {
+class Reorderer : public Sender {
 public:
-       Reorderer(Protocol* sender);
+       Reorderer(Sender* sender);
        void send_packet(uint16_t proto, const std::string& data, int seq);
-       virtual int fd() const { assert(false); }
 
 private:
        void check_ts_discontinuity(uint16_t proto, const std::string &data, bool silence);
 
-       Protocol* sender;
+       Sender* sender;
        int last_seq;
 
        std::priority_queue<GREPacket, std::vector<GREPacket>, std::greater<GREPacket>> packet_buffer;