68 static u32_t timeouts_last_time;
73 static int tcpip_tcp_timer_active;
81 tcpip_tcp_timer(
void *
arg)
88 if (tcp_active_pcbs || tcp_tw_pcbs) {
93 tcpip_tcp_timer_active = 0;
106 if (!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) {
108 tcpip_tcp_timer_active = 1;
122 ip_reass_timer(
void *arg)
154 dhcp_timer_coarse(
void *arg)
168 dhcp_timer_fine(
void *arg)
184 autoip_timer(
void *arg)
200 igmp_timer(
void *arg)
248 ip6_reass_timer(
void *arg)
264 mld6_timer(
void *arg)
310 timeouts_last_time =
sys_now();
324 #if LWIP_DEBUG_TIMERNAMES 338 if (timeout ==
NULL) {
339 LWIP_ASSERT(
"sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty", timeout !=
NULL);
345 if (next_timeout ==
NULL) {
347 timeouts_last_time = now;
349 diff = now - timeouts_last_time;
354 timeout->
h = handler;
357 timeout->
time = msecs + diff;
359 timeout->
time = msecs;
361 #if LWIP_DEBUG_TIMERNAMES 362 timeout->handler_name = handler_name;
364 (
void *)timeout, msecs, handler_name, (
void *)arg));
367 if (next_timeout ==
NULL) {
368 next_timeout = timeout;
372 if (next_timeout->
time > msecs) {
373 next_timeout->
time -= msecs;
374 timeout->
next = next_timeout;
375 next_timeout = timeout;
377 for (t = next_timeout; t !=
NULL; t = t->
next) {
404 if (next_timeout ==
NULL) {
408 for (t = next_timeout, prev_t =
NULL; t !=
NULL; prev_t = t, t = t->
next) {
409 if ((t->h == handler) && (t->arg == arg)) {
412 if (prev_t ==
NULL) {
413 next_timeout = t->
next;
418 if (t->next !=
NULL) {
437 sys_check_timeouts(
void)
449 diff = now - timeouts_last_time;
451 #if PBUF_POOL_FREE_OOSEQ 452 PBUF_CHECK_FREE_OOSEQ();
455 tmptimeout = next_timeout;
456 if (tmptimeout && (tmptimeout->
time <= diff)) {
459 timeouts_last_time += tmptimeout->
time;
460 diff -= tmptimeout->
time;
461 next_timeout = tmptimeout->
next;
462 handler = tmptimeout->
h;
463 arg = tmptimeout->
arg;
464 #if LWIP_DEBUG_TIMERNAMES 465 if (handler !=
NULL) {
467 tmptimeout->handler_name, arg));
471 if (handler !=
NULL) {
486 sys_restart_timeouts(
void)
488 timeouts_last_time =
sys_now();
495 sys_timeouts_sleeptime(
void)
498 if (next_timeout ==
NULL) {
501 diff =
sys_now() - timeouts_last_time;
502 if (diff > next_timeout->
time) {
505 return next_timeout->
time - diff;
530 if (next_timeout->
time > 0) {
540 tmptimeout = next_timeout;
541 next_timeout = tmptimeout->
next;
542 handler = tmptimeout->
h;
543 arg = tmptimeout->
arg;
544 #if LWIP_DEBUG_TIMERNAMES 545 if (handler !=
NULL) {
547 tmptimeout->handler_name, arg));
551 if (handler !=
NULL) {
566 if (time_needed < next_timeout->
time) {
567 next_timeout->
time -= time_needed;
569 next_timeout->
time = 0;
#define LOCK_TCPIP_CORE()
void tcp_timer_needed(void)
#define LWIP_TCPIP_THREAD_ALIVE()
u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
void memp_free(memp_t type, void *mem)
void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)
#define LWIP_ASSERT(message, assertion)
#define UNLOCK_TCPIP_CORE()
void(* sys_timeout_handler)(void *arg)
void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg)
void * memp_malloc(memp_t type)
#define LWIP_DEBUGF(debug, message)
#define LWIP_UNUSED_ARG(x)
void sys_timeouts_init(void)
void sys_untimeout(sys_timeout_handler handler, void *arg)