summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/bsu/beacon/defs.h3
-rw-r--r--cesar/bsu/beacon/src/beacon.c4
-rw-r--r--cesar/bsu/src/bsu.c9
3 files changed, 12 insertions, 4 deletions
diff --git a/cesar/bsu/beacon/defs.h b/cesar/bsu/beacon/defs.h
index 9b1479026f..8737b4bb94 100644
--- a/cesar/bsu/beacon/defs.h
+++ b/cesar/bsu/beacon/defs.h
@@ -159,4 +159,7 @@ typedef enum bsu_beacon_entry_header_t bsu_beacon_entry_header_t;
#define BSU_BEACON_ENTRY_SIZE_REGION(nr) \
(1 + BSU_BEACON_ENTRY_SIZE_REGION_DESC * nr)
+/** Define the infinite permanent schedule. */
+#define BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN 7
+
#endif /* bsu_beacon_inc_bmi_defs_h */
diff --git a/cesar/bsu/beacon/src/beacon.c b/cesar/bsu/beacon/src/beacon.c
index e2cc63c533..5ed22ab649 100644
--- a/cesar/bsu/beacon/src/beacon.c
+++ b/cesar/bsu/beacon/src/beacon.c
@@ -966,7 +966,9 @@ bsu_beacon_countdown (bsu_beacon_t *beacon)
/* Previous countdown. */
else if (beacon->bmis.ps.ps[nb].pscd)
beacon->bmis.ps.ps[nb].pscd--;
- else if (beacon->bmis.ps.ps[nb].cscd)
+ else if (beacon->bmis.ps.ps[nb].cscd
+ != BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN
+ && beacon->bmis.ps.ps[nb].cscd)
beacon->bmis.ps.ps[nb].cscd--;
}
/* Encryption key change. */
diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c
index 195fceae50..0b8403d07c 100644
--- a/cesar/bsu/src/bsu.c
+++ b/cesar/bsu/src/bsu.c
@@ -157,9 +157,12 @@ bsu_schedules_merge_process_init (bsu_t *ctx, bsu_beacon_schedules_t *sched,
/* Persistent schedules position index. */
for (i = 0; i < sched->ps.nb; i++)
{
- if (sched->ps.ps[i].pscd <= beacon_period_index
- && (u32) (sched->ps.ps[i].pscd + sched->ps.ps[i].cscd)
- >= beacon_period_index)
+ if ((sched->ps.ps[i].pscd <= beacon_period_index
+ && (u32) (sched->ps.ps[i].pscd + sched->ps.ps[i].cscd)
+ >= beacon_period_index)
+ || (sched->ps.ps[i].pscd == 0
+ && sched->ps.ps[i].cscd ==
+ BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN))
{
proc->ps = &sched->ps.ps[i];
proc->ps_alloc_index = 0;