From c3e9aa1cef98fd8d87dabadc472c5268eae28319 Mon Sep 17 00:00:00 2001 From: xueyunfei Date: Tue, 1 Nov 2022 20:37:35 +0800 Subject: [PATCH] lwip:Bugfix for get ip fail when stress test --- src/core/ipv4/dhcp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/ipv4/dhcp.c b/src/core/ipv4/dhcp.c index f2b1a42c..ff83991f 100644 --- a/src/core/ipv4/dhcp.c +++ b/src/core/ipv4/dhcp.c @@ -89,8 +89,12 @@ static bool is_tmr_start = false; #define ESP_LWIP_DHCP_FINE_TIMER_START_ONCE() if (!is_tmr_start) { \ sys_timeout(DHCP_FINE_TIMER_MSECS, dhcp_fine_timeout_cb, NULL); \ is_tmr_start = true; } +#define ESP_LWIP_DHCP_FINE_CLOSE() if (is_tmr_start) { \ + sys_untimeout(dhcp_fine_timeout_cb, NULL); \ + is_tmr_start = false; } #else #define ESP_LWIP_DHCP_FINE_TIMER_START_ONCE() +#define ESP_LWIP_DHCP_FINE_CLOSE() #endif /* ESP_LWIP_DHCP_FINE_TIMERS_ONDEMAND */ #ifdef LWIP_HOOK_FILENAME @@ -1210,6 +1214,7 @@ dhcp_bind(struct netif *netif) /* netif is now bound to DHCP leased address - set this before assigning the address to ensure the callback can use dhcp_supplied_address() */ dhcp_set_state(dhcp, DHCP_STATE_BOUND); + ESP_LWIP_DHCP_FINE_CLOSE(); LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): dhcp state is BOUND\n")); netif_set_addr(netif, &dhcp->offered_ip_addr, &sn_mask, &gw_addr); /* interface is used by routing now that an address is set */