Bugfix: memory wasn't freed when a neighbor was dropped from the list. Also increase the max age to 180 minutes to allow for regular beacons to refresh the neighbor before it is dropped.

This commit is contained in:
adamdunkels 2011-01-09 21:20:05 +00:00
parent 90dc0ceebf
commit acf45ec648

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: collect-neighbor.c,v 1.8 2010/10/11 23:38:46 adamdunkels Exp $
* $Id: collect-neighbor.c,v 1.9 2011/01/09 21:20:05 adamdunkels Exp $
*/
/**
@ -63,7 +63,7 @@
MEMB(collect_neighbors_mem, struct collect_neighbor, MAX_COLLECT_NEIGHBORS);
#define MAX_AGE 60
#define MAX_AGE 180
#define MAX_LE_AGE 10
#define PERIODIC_INTERVAL CLOCK_SECOND * 60
@ -98,6 +98,7 @@ periodic(void *ptr)
n->le_age = 0;
}
if(n->age == MAX_AGE) {
memb_free(&collect_neighbors_mem, n);
list_remove(neighbor_list->list, n);
n = list_head(neighbor_list->list);
}