Added debugging, reduced wait time

This commit is contained in:
adamdunkels 2007-03-22 18:53:38 +00:00
parent 5b5d9209a1
commit 3134789a94

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: nf.c,v 1.7 2007/03/21 23:21:54 adamdunkels Exp $
* $Id: nf.c,v 1.8 2007/03/22 18:53:38 adamdunkels Exp $
*/
/**
@ -43,7 +43,7 @@
#include "lib/rand.h"
#include <string.h>
#define QUEUE_TIME CLOCK_SECOND / 2
#define QUEUE_TIME CLOCK_SECOND / 4
#define HOPS_MAX 16
@ -57,6 +57,15 @@ static u8_t seqno;
static void send(void *ptr);
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
/*---------------------------------------------------------------------------*/
static void
set_timer(struct nf_conn *c)
@ -77,6 +86,8 @@ send(void *ptr)
queuebuf_to_rimebuf(c->buf);
queuebuf_free(c->buf);
c->buf = NULL;
PRINTF("%d.%d: nf send to uibc\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
uibc_send(&c->c, QUEUE_TIME);
if(c->u->sent != NULL) {
c->u->sent(c);
@ -129,10 +140,13 @@ recv_from_uibc(struct uibc_conn *uibc, rimeaddr_t *from)
/* Rebroadcast received packet. */
if(hops < HOPS_MAX) {
/* printf("rebroadcasting %d/%d (%d/%d) hops %d\n",
hdr->originator_id, hdr->originator_seqno,
c->last_originator_id, c->last_originator_seqno,
hops);*/
PRINTF("%d.%d: nf rebroadcasting %d.%d/%d (%d.%d/%d) hops %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
hdr->originator.u8[0], hdr->originator.u8[1],
hdr->originator_seqno,
c->last_originator.u8[0], c->last_originator.u8[1],
c->last_originator_seqno,
hops);
hdr->hops++;
queue_for_send(c);
rimeaddr_copy(&c->last_originator, &hdr->originator);