From e1ef13dad64dd0d32aff9aa513bbf581440edd7b Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Tue, 10 Feb 2009 00:44:50 +0000 Subject: [PATCH] Reduced the size of the packet cache from four to two to avoid falseley dismissing fresh packets (the header field that hold sequence numbers is only two bits wide, hence all sequence numbers fits in a four-entry cache...) --- core/net/rime/collect.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/net/rime/collect.c b/core/net/rime/collect.c index 2c683755b..8a37a33d7 100644 --- a/core/net/rime/collect.c +++ b/core/net/rime/collect.c @@ -36,7 +36,7 @@ * * This file is part of the Contiki operating system. * - * $Id: collect.c,v 1.16 2009/02/09 20:58:25 adamdunkels Exp $ + * $Id: collect.c,v 1.17 2009/02/10 00:44:50 adamdunkels Exp $ */ /** @@ -68,7 +68,7 @@ static const struct rimebuf_attrlist attributes[] = RIMEBUF_ATTR_LAST }; -#define NUM_RECENT_PACKETS 4 +#define NUM_RECENT_PACKETS 2 struct recent_packet { rimeaddr_t originator; @@ -156,9 +156,11 @@ node_packet_received(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno) packet exists in the list, we drop the packet. */ for(i = 0; i < NUM_RECENT_PACKETS; i++) { - if(recent_packets[i].seqno == rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID)&& + if(recent_packets[i].seqno == rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID) && rimeaddr_cmp(&recent_packets[i].originator, rimebuf_addr(RIMEBUF_ADDR_ESENDER))) { + PRINTF("%d.%d: dropping duplicate packet with seqno %d\n", + rimebuf_attr(RIMEBUF_ATTR_EPACKET_ID)); /* Drop the packet. */ return; }