Send announcements only if the node is configured to be a router

This commit is contained in:
Adam Dunkels 2013-03-17 23:52:42 +01:00
parent 5993595a8f
commit cb2336a322

View file

@ -641,8 +641,10 @@ send_queued_packet(struct collect_conn *c)
ctimer_set(&c->transmit_after_scan_timer, ANNOUNCEMENT_SCAN_TIME,
send_queued_packet, c);
#else /* COLLECT_CONF_WITH_LISTEN */
announcement_set_value(&c->announcement, RTMETRIC_MAX);
announcement_bump(&c->announcement);
if(c->is_router) {
announcement_set_value(&c->announcement, RTMETRIC_MAX);
announcement_bump(&c->announcement);
}
#endif /* COLLECT_CONF_WITH_LISTEN */
#endif /* COLLECT_ANNOUNCEMENTS */
}
@ -1256,7 +1258,9 @@ received_announcement(struct announcement *a, const rimeaddr_t *from,
#if ! COLLECT_CONF_WITH_LISTEN
if(value == RTMETRIC_MAX &&
tc->rtmetric != RTMETRIC_MAX) {
announcement_bump(&tc->announcement);
if(tc->is_router) {
announcement_bump(&tc->announcement);
}
}
#endif /* COLLECT_CONF_WITH_LISTEN */
}
@ -1302,7 +1306,9 @@ collect_open(struct collect_conn *tc, uint16_t channels,
announcement_register(&tc->announcement, channels,
received_announcement);
#if ! COLLECT_CONF_WITH_LISTEN
announcement_set_value(&tc->announcement, RTMETRIC_MAX);
if(tc->is_router) {
announcement_set_value(&tc->announcement, RTMETRIC_MAX);
}
#endif /* COLLECT_CONF_WITH_LISTEN */
#endif /* !COLLECT_ANNOUNCEMENTS */
@ -1470,8 +1476,10 @@ collect_send(struct collect_conn *tc, int rexmits)
ctimer_set(&tc->transmit_after_scan_timer, ANNOUNCEMENT_SCAN_TIME,
send_queued_packet, tc);
#else /* COLLECT_CONF_WITH_LISTEN */
announcement_set_value(&tc->announcement, RTMETRIC_MAX);
announcement_bump(&tc->announcement);
if(tc->is_router) {
announcement_set_value(&tc->announcement, RTMETRIC_MAX);
announcement_bump(&tc->announcement);
}
#endif /* COLLECT_CONF_WITH_LISTEN */
#endif /* COLLECT_ANNOUNCEMENTS */