From cae8ef206ac6b5b56ea29556cc51d4710cc4a0a2 Mon Sep 17 00:00:00 2001 From: Zhitao He Date: Wed, 27 Apr 2011 19:12:46 +0200 Subject: [PATCH] fixed excessive retransmissions of junk packets after runicast timeout fixed stuck packet ID for next packet after runicast timeout --- core/net/rime/runicast.c | 7 ++++--- core/net/rime/stunicast.c | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/net/rime/runicast.c b/core/net/rime/runicast.c index e03a881d1..946fef0e7 100644 --- a/core/net/rime/runicast.c +++ b/core/net/rime/runicast.c @@ -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); } } } diff --git a/core/net/rime/stunicast.c b/core/net/rime/stunicast.c index 3309bfd64..554e81da0 100644 --- a/core/net/rime/stunicast.c +++ b/core/net/rime/stunicast.c @@ -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); }*/