Set a higher start ETX. Avoiding adding a neighbor after a failed packet transmission.

This commit is contained in:
nvt-se 2010-03-19 16:55:29 +00:00
parent f2a1604b63
commit 0eae63b29a

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: neighbor-info.c,v 1.3 2010/03/17 15:08:46 nvt-se Exp $
* $Id: neighbor-info.c,v 1.4 2010/03/19 16:55:29 nvt-se Exp $
*/
/**
* \file
@ -56,7 +56,7 @@
#define ETX_SCALE 100
#define ETX_ALPHA 60
#define ETX_FIRST_GUESS 1
#define ETX_FIRST_GUESS (ETX_LIMIT - 1)
#define ETX_COLLISION_PENALTY 5
#define ETX_NO_ACK_PENALTY (ETX_LIMIT + 1)
/*---------------------------------------------------------------------------*/
@ -77,6 +77,7 @@ update_etx(const rimeaddr_t *dest, int packet_etx)
recorded_etx = *etxp;
}
/* Update the EWMA of the ETX for the neighbor. */
new_etx = (ETX_SCALE / 2 + ETX_ALPHA * recorded_etx +
(ETX_SCALE - ETX_ALPHA) * packet_etx) / ETX_SCALE;
PRINTF("neighbor-info: ETX changed from %d to %d (packet ETX = %d)\n",
@ -85,7 +86,7 @@ update_etx(const rimeaddr_t *dest, int packet_etx)
if(new_etx > ETX_LIMIT) {
neighbor_attr_remove_neighbor(dest);
subscriber_callback(dest, 0, new_etx);
} else {
} else if(neighbor_attr_has_neighbor(dest)) {
neighbor_attr_set_data(&etx, dest, &new_etx);
if(new_etx != recorded_etx && subscriber_callback != NULL) {
subscriber_callback(dest, 1, new_etx);