diff options
author | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-10-02 16:38:26 +0200 |
---|---|---|
committer | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-10-02 16:38:26 +0200 |
commit | b451464a088999137097e7b364942bac12a65e67 (patch) | |
tree | 088d45006fcfbd4682952e853e3c83330ee6eba1 | |
parent | 5d3806897b1d9b406135ba9b8b460ed5b5a21cf0 (diff) | |
download | MAC-Telnet-b451464a088999137097e7b364942bac12a65e67.tar.gz MAC-Telnet-b451464a088999137097e7b364942bac12a65e67.zip |
Drop double/old packets. No more random buggy terminal!
-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) { |