JaydenH215 commented on a change in pull request #731: update
ble_ll_sched_adv_reschedule
URL: https://github.com/apache/mynewt-nimble/pull/731#discussion_r367536815
##########
File path: nimble/controller/src/ble_ll_sched.c
##########
@@ -961,20 +966,25 @@ ble_ll_sched_adv_reschedule(struct ble_ll_sched_item
*sch, uint32_t *start,
* with original duration.
*/
before = NULL;
- orig_start = sch->start_time;
+ sch->start_time = orig_start;
entry = start_overlap;
sch->end_time = sch->start_time + duration;
while (1) {
next_sch = entry->link.tqe_next;
if ((int32_t)(sch->end_time - entry->start_time) <= 0) {
- rand_ticks = entry->start_time - sch->end_time;
- before = entry;
- TAILQ_INSERT_BEFORE(before, sch, link);
- break;
- } else {
- sch->start_time = entry->end_time;
- sch->end_time = sch->start_time + duration;
Review comment:
I think
`rand_ticks = (orig_start + max_delay_ticks) - sch->start_time; `
equal to
`rand_ticks = (orig_end + max_delay_ticks) - sch->end_time; `
If we can insert sch into link, this means `sch->end_time <= orig_end +
max_delay_ticks`, so we can make sure sch will not overflow(max_delay). If
`sch` overlaps `next_sch`, `end_overlap` should be `next_sch` (sch->end_time <=
orig_end + max_delay < end_overlap->next_sch->start_time).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services