diff --git a/src/coap_address.c b/src/coap_address.c index 322c4b86..6eca65ad 100644 --- a/src/coap_address.c +++ b/src/coap_address.c @@ -139,10 +139,10 @@ coap_is_mcast(const coap_address_t *a) { return 0; } -#if !defined(WIN32) && !defined(ESPIDF_VERSION) +#if !defined(WIN32) #ifndef COAP_BCST_CNT -#define COAP_BCST_CNT 6 +#define COAP_BCST_CNT 15 #endif /* COAP_BCST_CNT */ /* How frequently to refresh the list of valid IPv4 broadcast addresses */ @@ -150,21 +150,25 @@ coap_is_mcast(const coap_address_t *a) { #define COAP_BCST_REFRESH_SECS 30 #endif /* COAP_BCST_REFRESH_SECS */ -#if COAP_IPV4_SUPPORT +#if COAP_IPV4_SUPPORT && !defined(ESPIDF_VERSION) static int bcst_cnt = -1; static coap_tick_t last_refresh; static struct in_addr b_ipv4[COAP_BCST_CNT]; -#endif /* COAP_IPV4_SUPPORT */ +#endif /* COAP_IPV4_SUPPORT && ! ESPIDF_VERSION */ +#if !defined(ESPIDF_VERSION) #include #include +#endif /* ! ESPIDF_VERSION */ int coap_is_bcast(const coap_address_t *a) { #if COAP_IPV4_SUPPORT struct in_addr ipv4; +#if !defined(ESPIDF_VERSION) int i; coap_tick_t now; +#endif /* ! ESPIDF_VERSION */ #endif /* COAP_IPV4_SUPPORT */ if (!a) @@ -194,6 +198,7 @@ coap_is_bcast(const coap_address_t *a) { if (ipv4.s_addr == INADDR_BROADCAST) return 1; +#if !defined(ESPIDF_VERSION) coap_ticks(&now); if (bcst_cnt == -1 || (now - last_refresh) > (COAP_BCST_REFRESH_SECS * COAP_TICKS_PER_SECOND)) { @@ -225,10 +230,11 @@ coap_is_bcast(const coap_address_t *a) { if (ipv4.s_addr == b_ipv4[i].s_addr) return 1; } +#endif /* ESPIDF_VERSION */ return 0; #endif /* COAP_IPV4_SUPPORT */ } -#else /* WIN32 || ESPIDF_VERSION */ +#else /* WIN32 */ int coap_is_bcast(const coap_address_t *a) { (void)a;