diff options
-rw-r--r-- | main.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -40,6 +40,7 @@ int sockfd; int deviceIndex; int outcounter=0; +int incounter=0; int sessionkey=0; int running = 1; @@ -129,6 +130,13 @@ void handlePacket(unsigned char *data, int data_len) { if (DEBUG) printf("ACK: Plen = %d, Send result: %d\n", plen, result); + if (incounter == 0 || pkthdr.counter > incounter) + incounter = pkthdr.counter; + else { + /* Ignore double or old packets */ + return; + } + rest = data_len - 22; p += 22; while (rest > 0) { |