Added debugging, reduced wait time
This commit is contained in:
parent
5b5d9209a1
commit
3134789a94
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* 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 "lib/rand.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define QUEUE_TIME CLOCK_SECOND / 2
|
#define QUEUE_TIME CLOCK_SECOND / 4
|
||||||
|
|
||||||
#define HOPS_MAX 16
|
#define HOPS_MAX 16
|
||||||
|
|
||||||
|
@ -57,6 +57,15 @@ static u8_t seqno;
|
||||||
|
|
||||||
static void send(void *ptr);
|
static void send(void *ptr);
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
#if DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
set_timer(struct nf_conn *c)
|
set_timer(struct nf_conn *c)
|
||||||
|
@ -77,6 +86,8 @@ send(void *ptr)
|
||||||
queuebuf_to_rimebuf(c->buf);
|
queuebuf_to_rimebuf(c->buf);
|
||||||
queuebuf_free(c->buf);
|
queuebuf_free(c->buf);
|
||||||
c->buf = NULL;
|
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);
|
uibc_send(&c->c, QUEUE_TIME);
|
||||||
if(c->u->sent != NULL) {
|
if(c->u->sent != NULL) {
|
||||||
c->u->sent(c);
|
c->u->sent(c);
|
||||||
|
@ -129,10 +140,13 @@ recv_from_uibc(struct uibc_conn *uibc, rimeaddr_t *from)
|
||||||
|
|
||||||
/* Rebroadcast received packet. */
|
/* Rebroadcast received packet. */
|
||||||
if(hops < HOPS_MAX) {
|
if(hops < HOPS_MAX) {
|
||||||
/* printf("rebroadcasting %d/%d (%d/%d) hops %d\n",
|
PRINTF("%d.%d: nf rebroadcasting %d.%d/%d (%d.%d/%d) hops %d\n",
|
||||||
hdr->originator_id, hdr->originator_seqno,
|
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
||||||
c->last_originator_id, c->last_originator_seqno,
|
hdr->originator.u8[0], hdr->originator.u8[1],
|
||||||
hops);*/
|
hdr->originator_seqno,
|
||||||
|
c->last_originator.u8[0], c->last_originator.u8[1],
|
||||||
|
c->last_originator_seqno,
|
||||||
|
hops);
|
||||||
hdr->hops++;
|
hdr->hops++;
|
||||||
queue_for_send(c);
|
queue_for_send(c);
|
||||||
rimeaddr_copy(&c->last_originator, &hdr->originator);
|
rimeaddr_copy(&c->last_originator, &hdr->originator);
|
||||||
|
|
Loading…
Reference in a new issue