mirror of
https://github.com/espressif/esp-lwip.git
synced 2026-08-19 08:20:04 +00:00
dhcp: Reduce discover and request retry backoff time
2.1.3-esp:33912690reduce the DHCP Request timeout 2.1.3-esp:269a58f1lower the dhcp discover and request retry backoff time
This commit is contained in:
committed by
David Cermak
parent
65dd329f0c
commit
03060d3296
@@ -144,7 +144,7 @@ static bool is_tmr_start = false;
|
||||
#define DHCP_SET_TIMEOUT_FROM_OFFERED_T2_REBIND(res, dhcp) SET_TIMEOUT_FROM_OFFERED(res, (dhcp)->offered_t2_rebind, 0, 0xffff)
|
||||
|
||||
#define DHCP_NEXT_TIMEOUT_THRESHOLD ((60 + DHCP_COARSE_TIMER_SECS / 2) / DHCP_COARSE_TIMER_SECS)
|
||||
#define DHCP_REQUEST_BACKOFF_SEQUENCE(tries) (u16_t)(( (tries) < 6 ? 1 << (tries) : 60) * 1000)
|
||||
#define DHCP_REQUEST_BACKOFF_SEQUENCE(state, tries) ((u16_t)(( (tries) < 6 ? 1 << (tries) : 60) * 1000))
|
||||
|
||||
#endif /* DHCP_DEFINE_CUSTOM_TIMEOUTS */
|
||||
|
||||
@@ -521,7 +521,7 @@ dhcp_select(struct netif *netif)
|
||||
if (dhcp->tries < 255) {
|
||||
dhcp->tries++;
|
||||
}
|
||||
msecs = (u16_t)((dhcp->tries < 6 ? 1 << dhcp->tries : 60) * 1000);
|
||||
msecs = DHCP_REQUEST_BACKOFF_SEQUENCE(DHCP_STATE_REQUESTING, dhcp->tries);
|
||||
dhcp->request_timeout = (u16_t)((msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS);
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_select(): set request timeout %"U16_F" msecs\n", msecs));
|
||||
ESP_LWIP_DHCP_FINE_TIMER_START_ONCE();
|
||||
@@ -1128,7 +1128,7 @@ dhcp_discover(struct netif *netif)
|
||||
if (dhcp->tries < 255) {
|
||||
dhcp->tries++;
|
||||
}
|
||||
msecs = DHCP_REQUEST_BACKOFF_SEQUENCE(dhcp->tries);
|
||||
msecs = DHCP_REQUEST_BACKOFF_SEQUENCE(DHCP_STATE_SELECTING, dhcp->tries);
|
||||
dhcp->request_timeout = (u16_t)((msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS);
|
||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_discover(): set request timeout %"U16_F" msecs\n", msecs));
|
||||
ESP_LWIP_DHCP_FINE_TIMER_START_ONCE();
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
#define DHCP_DEFINE_CUSTOM_TIMEOUTS 1
|
||||
#define DHCP_COARSE_TIMER_SECS (1)
|
||||
#define DHCP_NEXT_TIMEOUT_THRESHOLD (3)
|
||||
#define DHCP_REQUEST_BACKOFF_SEQUENCE(tries) (( (tries) < 6 ? 1 << (tries) : 60) * 250)
|
||||
#define DHCP_REQUEST_BACKOFF_SEQUENCE(state, tries) ((uint16_t)(((tries) < 5 ? 1 << (tries) : 16) * 250))
|
||||
|
||||
#include <stdint.h>
|
||||
static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min)
|
||||
|
||||
Reference in New Issue
Block a user