Skip to content

Commit

Permalink
Add new CHIP_CONFIG_ADDRESS_RESOLVE_MIN_LOOKUP_TIME_MS and (#35102)
Browse files Browse the repository at this point in the history
CHIP_CONFIG_ADDRESS_RESOLVE_MAX_LOOKUP_TIME_MS macros to CHIPConfig.
Use new lookup time min/max macros inside AddressResolve for default
kMinLookupTimeMsDefault and kMaxLookupTimeMsDefault to allow for applications
to override the time required to wait for an address lookup before timing
out.
  • Loading branch information
s-mcclain authored and pull[bot] committed Nov 26, 2024
1 parent 34eaf92 commit 3366185
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/address_resolve/AddressResolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
22 changes: 22 additions & 0 deletions src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 3366185

Please sign in to comment.