mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-07 06:28:03 +08:00
fix(lwip): Fix dhcpserver cannot release dhcpclient info on time
This commit is contained in:
@ -1154,6 +1154,7 @@ void dhcps_start(struct netif *netif, ip4_addr_t ip)
|
||||
|
||||
udp_bind(pcb_dhcps, &netif->ip_addr, DHCPS_SERVER_PORT);
|
||||
udp_recv(pcb_dhcps, handle_dhcp, NULL);
|
||||
sys_timeout(1000, dhcps_coarse_tmr, NULL);
|
||||
#if DHCPS_DEBUG
|
||||
DHCPS_LOG("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps\n");
|
||||
#endif
|
||||
@ -1175,6 +1176,8 @@ void dhcps_stop(struct netif *netif)
|
||||
return;
|
||||
}
|
||||
|
||||
sys_untimeout(dhcps_coarse_tmr, NULL);
|
||||
|
||||
if (pcb_dhcps != NULL) {
|
||||
udp_disconnect(pcb_dhcps);
|
||||
udp_remove(pcb_dhcps);
|
||||
@ -1267,6 +1270,11 @@ void dhcps_coarse_tmr(void)
|
||||
if (num_dhcps_pool > MAX_STATION_NUM) {
|
||||
kill_oldest_dhcps_pool();
|
||||
}
|
||||
|
||||
/*Do not restart timer when dhcp server is stopped*/
|
||||
if (pcb_dhcps != NULL) {
|
||||
sys_timeout(1000, dhcps_coarse_tmr, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -89,6 +89,7 @@ bool dhcp_search_ip_on_mac(u8_t *mac, ip4_addr_t *ip);
|
||||
void dhcps_dns_setserver(const ip_addr_t *dnsserver);
|
||||
ip4_addr_t dhcps_dns_getserver();
|
||||
void dhcps_set_new_lease_cb(dhcps_cb_t cb);
|
||||
void dhcps_coarse_tmr(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user