Periodically increase sequence number to avoid active registrations being garbage collected in neighbors

This commit is contained in:
adamdunkels 2010-06-15 19:32:29 +00:00
parent 7647cbd8aa
commit f8437ad545

View file

@ -31,7 +31,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: servreg-hack.c,v 1.1 2010/06/15 19:00:28 adamdunkels Exp $
* $Id: servreg-hack.c,v 1.2 2010/06/15 19:32:29 adamdunkels Exp $
*/
/**
@ -93,6 +93,16 @@ static void
purge_registrations(void)
{
struct servreg_hack_registration *t;
for(t = list_head(own_services);
t != NULL;
t = list_item_next(t)) {
if(timer_expired(&t->timer)) {
t->seqno++;
timer_set(&t->timer, LIFETIME / 2);
}
}
for(t = list_head(others_services);
t != NULL;
t = list_item_next(t)) {
@ -139,6 +149,7 @@ servreg_hack_register(servreg_hack_id_t id)
}
r->id = id;
r->seqno = 1;
timer_set(&r->timer, LIFETIME / 2);
list_push(own_services, r);