static unsigned int packets;
static unsigned int initial_data_seq_num;
+static unsigned int next_data_seq_num;
static enum wget_state current_wget_state;
current_wget_state = WGET_TRANSFERRING;
+ initial_data_seq_num = tcp_seq_num + hlen;
+ next_data_seq_num = tcp_seq_num + len;
+
if (strstr((char *)pkt, http_ok) == 0) {
debug_cond(DEBUG_WGET,
"wget: Connected Bad Xfer\n");
- initial_data_seq_num = tcp_seq_num + hlen;
wget_loop_state = NETLOOP_FAIL;
wget_send(action, tcp_seq_num, tcp_ack_num, len);
} else {
debug_cond(DEBUG_WGET,
"wget: Connctd pkt %p hlen %x\n",
pkt, hlen);
- initial_data_seq_num = tcp_seq_num + hlen;
pos = strstr((char *)pkt, content_len);
if (!pos) {
"wget: Transferring, seq=%x, ack=%x,len=%x\n",
tcp_seq_num, tcp_ack_num, len);
+ if (next_data_seq_num != tcp_seq_num) {
+ debug_cond(DEBUG_WGET, "wget: seq=%x packet was lost\n", next_data_seq_num);
+ return;
+ }
+ next_data_seq_num = tcp_seq_num + len;
+
if (tcp_seq_num >= initial_data_seq_num &&
store_block(pkt, tcp_seq_num - initial_data_seq_num,
len) != 0) {