diff --git a/src/btstack_run_loop_base.c b/src/btstack_run_loop_base.c index cfbea297d..f0bf3a278 100644 --- a/src/btstack_run_loop_base.c +++ b/src/btstack_run_loop_base.c @@ -81,14 +81,9 @@ bool btstack_run_loop_base_remove_timer(btstack_timer_source_t *ts){ void btstack_run_loop_base_add_timer(btstack_timer_source_t *ts){ btstack_linked_item_t *it; for (it = (btstack_linked_item_t *) &btstack_run_loop_base_timers; it->next ; it = it->next){ - // don't add timer that's already in there - if ((btstack_timer_source_t *) it->next == ts){ - log_error( "btstack_run_loop_timer_add error: timer to add already in list!"); - return; - } - // exit if list timeout is after new timeout - uint32_t list_timeout = ((btstack_timer_source_t *) it->next)->timeout; - int32_t delta = btstack_time_delta(ts->timeout, list_timeout); + btstack_timer_source_t * next = (btstack_timer_source_t *) it->next; + btstack_assert(next != ts); + int32_t delta = btstack_time_delta(ts->timeout, next->timeout); if (delta < 0) break; } ts->item.next = it->next;