Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable MDNS lookup on first message deliver failure be default #22678

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/messaging/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import("//build_overrides/chip.gni")
declare_args() {
# Allows to change time between retries during the case session
chip_case_retry_delta = ""

chip_config_mrp_on_first_msg_fail_do_mdsn_lookup = ""
tehampson marked this conversation as resolved.
Show resolved Hide resolved
}

defines = []
Expand All @@ -26,6 +28,10 @@ if (chip_case_retry_delta != "") {
[ "CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL=${chip_case_retry_delta}" ]
}

if (chip_config_mrp_on_first_msg_fail_do_mdsn_lookup != "") {
defines += [ "CHIP_CONFIG_MRP_ON_FIRST_MSG_FAIL_DO_MDNS_LOOKUP=${chip_config_mrp_on_first_msg_fail_do_mdsn_lookup}" ]
}

source_set("messaging_mrp_config") {
sources = [ "ReliableMessageProtocolConfig.h" ]

Expand Down
2 changes: 2 additions & 0 deletions src/messaging/ReliableMessageMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ CHIP_ERROR ReliableMessageMgr::SendFromRetransTable(RetransTableEntry * entry)

if (err == CHIP_NO_ERROR)
{
#if CHIP_CONFIG_MRP_ON_FIRST_MSG_FAIL_DO_MDNS_LOOKUP
const ExchangeManager * exchangeMgr = entry->ec->GetExchangeMgr();
// TODO: investigate why in ReliableMessageMgr::CheckResendApplicationMessageWithPeerExchange unit test released exchange
// context with mExchangeMgr==nullptr is used.
Expand All @@ -329,6 +330,7 @@ CHIP_ERROR ReliableMessageMgr::SendFromRetransTable(RetransTableEntry * entry)
mSessionUpdateDelegate->UpdatePeerAddress(entry->ec->GetSessionHandle()->GetPeer());
}
}
#endif // CHIP_CONFIG_MRP_ON_FIRST_MSG_FAIL_DO_MDNS_LOOKUP
}
else
{
Expand Down
16 changes: 16 additions & 0 deletions src/messaging/ReliableMessageProtocolConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ namespace chip {
#define CHIP_CONFIG_RMP_DEFAULT_ACK_TIMEOUT (200_ms32)
#endif // CHIP_CONFIG_RMP_DEFAULT_ACK_TIMEOUT

/**
* @def CHIP_CONFIG_MRP_ON_FIRST_MSG_FAIL_DO_MDNS_LOOKUP
*
* @brief
* Should an address lookup of the peer happen on every first message that fails
* to send on the link.
*
* The default value selected to not perform lookup was for the following reasons:
* 1. The likelihood of the IP address changing right away is extremely slim.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could come after point 2) below.

* 2. On bad links, there resolutions occur extremely frequently, making the link
tehampson marked this conversation as resolved.
Show resolved Hide resolved
* worse.
tehampson marked this conversation as resolved.
Show resolved Hide resolved
tehampson marked this conversation as resolved.
Show resolved Hide resolved
*/
#ifndef CHIP_CONFIG_MRP_ON_FIRST_MSG_FAIL_DO_MDNS_LOOKUP
#define CHIP_CONFIG_MRP_ON_FIRST_MSG_FAIL_DO_MDNS_LOOKUP 0
#endif // CHIP_CONFIG_MRP_ON_FIRST_MSG_FAIL_DO_MDNS_LOOKUP

/**
* @def CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE
*
Expand Down