diff --git a/src/lib/address_resolve/AddressResolve.h b/src/lib/address_resolve/AddressResolve.h index 0d6f8ab719519d..1e45ffed5da907 100644 --- a/src/lib/address_resolve/AddressResolve.h +++ b/src/lib/address_resolve/AddressResolve.h @@ -143,8 +143,14 @@ class NodeLookupRequest } private: - static constexpr uint32_t kMinLookupTimeMsDefault = 200; - static constexpr uint32_t kMaxLookupTimeMsDefault = 45000; + static_assert((CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS) <= (CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS), + "AddressResolveMinLookupTime must be equal or less than AddressResolveMaxLookupTime"); + static_assert((CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS) >= 0, + "AddressResolveMinLookupTime must be equal or greater than 0"); + static_assert((CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS) < UINT32_MAX, + "AddressResolveMaxLookupTime must be less than UINT32_MAX"); + static constexpr uint32_t kMinLookupTimeMsDefault = CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS; + static constexpr uint32_t kMaxLookupTimeMsDefault = CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS; PeerId mPeerId; System::Clock::Milliseconds32 mMinLookupTimeMs{ kMinLookupTimeMsDefault }; diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index e9c317dfc79d5c..7600b4eaa4c315 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1370,6 +1370,28 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; #define CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS 1 #endif // CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS +/** + * @def CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS + * + * @brief Default minimum lookup time to wait during address resolve for + * additional DNSSD queries even if a reply has already been received, or + * to allow for additional heuristics regarding node choice to succeed, in + * milliseconds + */ +#ifndef CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS +#define CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS 200 +#endif // CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS + +/** + * @def CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS + * + * @brief Default maximum lookup time to wait during address resolve before + * a TIMEOUT error, in milliseconds + */ +#ifndef CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS +#define CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS 45000 +#endif // CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS + /* * @def CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE *