From a6bd51f3615e524215f9496505e91f71e0baa5b2 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 14 Jun 2010 06:51:58 +0000 Subject: [PATCH] If a packet is lost due to NOACK or TXERR, we count the number of transmissions and we add an additional loss penalty (currently one) --- core/net/neighbor-info.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/core/net/neighbor-info.c b/core/net/neighbor-info.c index 0d48a21a4..d7ebc801e 100644 --- a/core/net/neighbor-info.c +++ b/core/net/neighbor-info.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: neighbor-info.c,v 1.8 2010/06/08 19:25:40 adamdunkels Exp $ + * $Id: neighbor-info.c,v 1.9 2010/06/14 06:51:58 adamdunkels Exp $ */ /** * \file @@ -57,6 +57,7 @@ #define ETX_SCALE 100 #define ETX_ALPHA 80 #define ETX_FIRST_GUESS (ETX_LIMIT - 1) +#define ETX_LOSS_PENALTY 1 /*---------------------------------------------------------------------------*/ NEIGHBOR_ATTRIBUTE(uint8_t, etx, NULL); @@ -129,14 +130,9 @@ neighbor_info_packet_sent(int status, int numtx) break; case MAC_TX_ERR: case MAC_TX_NOACK: - /* if(neighbor_attr_has_neighbor(dest)) { - neighbor_attr_remove_neighbor(dest); - if(subscriber_callback != NULL) { - subscriber_callback(dest, 0, 0); - } - }*/ default: - return; + packet_etx = numtx + ETX_LOSS_PENALTY; + break; } update_etx(dest, packet_etx); @@ -170,5 +166,3 @@ neighbor_info_subscribe(neighbor_info_subscriber_t s) return 0; } /*---------------------------------------------------------------------------*/ - -/* XXX use a list of subscribers? */