fixed excessive retransmissions of junk packets after runicast timeout

fixed stuck packet ID for next packet after runicast timeout
This commit is contained in:
Zhitao He 2011-04-27 19:12:46 +02:00
parent 6e20a4c0ce
commit cae8ef206a
2 changed files with 9 additions and 6 deletions

View File

@ -101,11 +101,12 @@ sent_by_stunicast(struct stunicast_conn *stunicast, int status, int num_tx)
PRINTF("%d.%d: runicast: packet %d timed out\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
c->sndnxt);
c->sndnxt = (c->sndnxt + 1) % (1 << RUNICAST_PACKET_ID_BITS);
} else {
int shift;
// int shift;
shift = c->rxmit > 4? 4: c->rxmit;
stunicast_set_timer(&c->c, (REXMIT_TIME) << shift);
// shift = c->rxmit > 4? 4: c->rxmit;
// stunicast_set_timer(&c->c, (REXMIT_TIME) << shift);
}
}
}

View File

@ -113,9 +113,11 @@ send(void *ptr)
PRINTF("%d.%d: stunicast: resend to %d.%d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
c->receiver.u8[0], c->receiver.u8[1]);
queuebuf_to_packetbuf(c->buf);
unicast_send(&c->c, &c->receiver);
stunicast_set_timer(c, CLOCK_SECOND);
if(c->buf) {
queuebuf_to_packetbuf(c->buf);
unicast_send(&c->c, &c->receiver);
stunicast_set_timer(c, CLOCK_SECOND);
}
/* if(c->u->sent != NULL) {
c->u->sent(c);
}*/