Added a timer that randomizes the retransmission of an incoming new trickle version to avoid broadcast collisions

This commit is contained in:
adamdunkels 2009-04-06 21:20:35 +00:00
parent be1c8ccec9
commit ace6567815
2 changed files with 5 additions and 4 deletions

View File

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: trickle.c,v 1.16 2009/03/12 21:58:21 adamdunkels Exp $
* $Id: trickle.c,v 1.17 2009/04/06 21:20:35 adamdunkels Exp $
*/
/**
@ -164,7 +164,8 @@ recv(struct broadcast_conn *bc, rimeaddr_t *from)
c->q = queuebuf_new_from_packetbuf();
c->interval_scaling = 0;
reset_interval(c);
send(c);
ctimer_set(&c->first_transmission_timer, random_rand() % c->interval,
send, c);
c->cb->recv(c);
}
}

View File

@ -45,7 +45,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: trickle.h,v 1.10 2009/03/12 21:58:21 adamdunkels Exp $
* $Id: trickle.h,v 1.11 2009/04/06 21:20:35 adamdunkels Exp $
*/
/**
@ -74,7 +74,7 @@ struct trickle_callbacks {
struct trickle_conn {
struct broadcast_conn c;
const struct trickle_callbacks *cb;
struct ctimer t, interval_timer;
struct ctimer t, interval_timer, first_transmission_timer;
struct pt pt;
struct queuebuf *q;
clock_time_t interval;