Update annotation when removing preferred parent.

This commit is contained in:
nifi 2010-10-27 12:27:57 +00:00
parent d2a3f1f257
commit 25ceab07d2

View file

@ -32,7 +32,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rpl-dag.c,v 1.36 2010/10/27 12:20:35 nifi Exp $
* $Id: rpl-dag.c,v 1.37 2010/10/27 12:27:57 nifi Exp $
*/
/**
* \file
@ -312,8 +312,10 @@ rpl_select_parent(rpl_dag_t *dag)
if(dag->preferred_parent != best) {
/* Visualize the change of the preferred parent in Cooja. */
ANNOTATE("#L %u 0\n",
dag->preferred_parent->addr.u8[sizeof(best->addr) - 1]);
if(dag->preferred_parent != NULL) {
ANNOTATE("#L %u 0\n",
dag->preferred_parent->addr.u8[sizeof(best->addr) - 1]);
}
ANNOTATE("#L %u 1\n", best->addr.u8[sizeof(best->addr) - 1]);
dag->preferred_parent = best; /* Cache the value. */
@ -362,6 +364,7 @@ rpl_remove_parent(rpl_dag_t *dag, rpl_parent_t *parent)
PRINTF("\n");
if(parent == dag->preferred_parent) {
ANNOTATE("#L %u 0\n", parent->addr.u8[sizeof(parent->addr) - 1]);
dag->preferred_parent = NULL;
}