From d1de1e000190e3955215020661fb5d9811888440 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 21 Mar 2007 23:22:42 +0000 Subject: [PATCH] Added hop counting, remade the rimeaddr_t u16 to be an array rather than a scalar --- core/net/rime/tree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/net/rime/tree.c b/core/net/rime/tree.c index 5f5bb2427..9fe6329bf 100644 --- a/core/net/rime/tree.c +++ b/core/net/rime/tree.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: tree.c,v 1.4 2007/03/19 22:10:17 adamdunkels Exp $ + * $Id: tree.c,v 1.5 2007/03/21 23:22:42 adamdunkels Exp $ */ /** @@ -42,6 +42,7 @@ #include "net/rime.h" #include "net/rime/neighbor.h" +#include "net/rime/tree.h" #include "dev/radio-sensor.h" @@ -151,8 +152,9 @@ node_packet_received(struct ruc_conn *c, rimeaddr_t *from, u8_t seqno) } return 1; } else if(hdr->hoplim > 1 && tc.hello.hopcount != HOPCOUNT_MAX) { + hdr->hoplim--; printf("%d: packet received from %d, forwarding %d, best neighbor %p\n", - rimeaddr_node_addr.u16, from->u16, tc.forwarding, neighbor_best()); + rimeaddr_node_addr.u16[0], from->u16[0], tc.forwarding, neighbor_best()); if(!tc.forwarding) { tc.forwarding = 1; n = neighbor_best(); @@ -163,7 +165,7 @@ node_packet_received(struct ruc_conn *c, rimeaddr_t *from, u8_t seqno) } else { printf("%d: still forwarding another packet, not sending ACK\n", - rimeaddr_node_addr.u16); + rimeaddr_node_addr.u16[0]); return 0; } }