From 5a1a8e84d8738928f1b50614073f6126da38f8ad Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 23 Jun 2016 18:36:04 +0200 Subject: [PATCH] TSCH: start scheduling keep-alives only after tsch_is_associated is set --- core/net/mac/tsch/tsch.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/net/mac/tsch/tsch.c b/core/net/mac/tsch/tsch.c index 41aa56125..b97e1d634 100644 --- a/core/net/mac/tsch/tsch.c +++ b/core/net/mac/tsch/tsch.c @@ -562,10 +562,6 @@ tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp) if(n != NULL) { tsch_queue_update_time_source((linkaddr_t *)&frame.src_addr); -#ifdef TSCH_CALLBACK_JOINING_NETWORK - TSCH_CALLBACK_JOINING_NETWORK(); -#endif - /* Set PANID */ frame802154_set_pan_id(frame.src_pid); @@ -576,9 +572,13 @@ tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp) tsch_is_associated = 1; tsch_is_pan_secured = frame.fcf.security_enabled; - /* Association done, schedule keepalive messages */ + /* Start sending keep-alives now that tsch_is_associated is set */ tsch_schedule_keepalive(); +#ifdef TSCH_CALLBACK_JOINING_NETWORK + TSCH_CALLBACK_JOINING_NETWORK(); +#endif + PRINTF("TSCH: association done, sec %u, PAN ID %x, asn-%x.%lx, jp %u, timeslot id %u, hopping id %u, slotframe len %u with %u links, from ", tsch_is_pan_secured, frame.src_pid,