From 423dc1a9513a6513abb97cdfdefffa3becf41b1d Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Thu, 22 Mar 2007 17:37:10 +0000 Subject: [PATCH] Queued packet pointer should be NULL when no packet is queued --- core/net/rime/uabc.c | 4 +++- core/net/rime/uibc.c | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/core/net/rime/uabc.c b/core/net/rime/uabc.c index 7b163caf2..c966f8765 100644 --- a/core/net/rime/uabc.c +++ b/core/net/rime/uabc.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: uabc.c,v 1.2 2007/03/21 09:09:33 adamdunkels Exp $ + * $Id: uabc.c,v 1.3 2007/03/22 17:37:10 adamdunkels Exp $ */ /** @@ -56,6 +56,7 @@ recv(struct abc_conn *abc) /* We received a copy of our own packet, so we do not send out packet. */ queuebuf_free(c->q); + c->q = NULL; ctimer_stop(&c->t); if(c->cb->dropped) { c->cb->dropped(c); @@ -74,6 +75,7 @@ send(void *ptr) if(c->q != NULL) { queuebuf_to_rimebuf(c->q); queuebuf_free(c->q); + c->q = NULL; abc_send(&c->c); if(c->cb->sent) { c->cb->sent(c); diff --git a/core/net/rime/uibc.c b/core/net/rime/uibc.c index b42b1d459..4c44ebc29 100644 --- a/core/net/rime/uibc.c +++ b/core/net/rime/uibc.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: uibc.c,v 1.1 2007/03/21 23:21:01 adamdunkels Exp $ + * $Id: uibc.c,v 1.2 2007/03/22 17:37:10 adamdunkels Exp $ */ /** @@ -44,6 +44,14 @@ #include +#define DEBUG 0 +#if DEBUG +#include +#define PRINTF(...) printf(__VA_ARGS__) +#else +#define PRINTF(...) +#endif + /*---------------------------------------------------------------------------*/ static void recv(struct ibc_conn *ibc, rimeaddr_t *from) @@ -56,12 +64,15 @@ recv(struct ibc_conn *ibc, rimeaddr_t *from) /* We received a copy of our own packet, so we do not send out packet. */ queuebuf_free(c->q); + c->q = NULL; ctimer_stop(&c->t); if(c->cb->dropped) { c->cb->dropped(c); } } if(c->cb->recv) { + PRINTF("%d.%d: uibc calling recv\n", + rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); c->cb->recv(c, from); } } @@ -74,6 +85,9 @@ send(void *ptr) if(c->q != NULL) { queuebuf_to_rimebuf(c->q); queuebuf_free(c->q); + c->q = NULL; + PRINTF("%d.%d: uibc sending with ibc_send\n", + rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); ibc_send(&c->c); if(c->cb->sent) { c->cb->sent(c);