TSCH: reset now also flushes all queues and resets backoff exponents

This commit is contained in:
Simon Duquennoy 2016-03-15 16:10:01 +01:00
parent 4b4ea36e9b
commit 3057cb3363
3 changed files with 9 additions and 5 deletions

View file

@ -302,14 +302,17 @@ tsch_queue_free_packet(struct tsch_packet *p)
/*---------------------------------------------------------------------------*/
/* Flush all neighbor queues */
void
tsch_queue_flush_all(void)
tsch_queue_reset(void)
{
/* Deallocate unneeded neighbors */
if(!tsch_is_locked()) {
struct tsch_neighbor *n = list_head(neighbor_list);
while(n != NULL) {
struct tsch_neighbor *next_n = list_item_next(n);
/* Flush queue */
tsch_queue_flush_nbr_queue(n);
/* Reset backoff exponent */
tsch_queue_backoff_reset(n);
n = next_n;
}
}
@ -379,6 +382,7 @@ tsch_queue_get_packet_for_dest_addr(const linkaddr_t *addr, struct tsch_link *li
}
return NULL;
}
/*---------------------------------------------------------------------------*/
/* Returns the head packet of any neighbor queue with zero backoff counter.
* Writes pointer to the neighbor in *n */
struct tsch_packet *