Skip to content

Commit 7b5538a

Browse files
simonbarenclaude
andcommitted
Use full discovery timeout for both primary and fallback browse
Per maintainer review (jonathan-r-thorpe, lo-simon): the primary service timeout should remain unchanged when a fallback is in play, with the same timeout applied per service rather than halved across them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 337a4b5 commit 7b5538a

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

Development/nmos/mdns.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -765,22 +765,16 @@ namespace nmos
765765
const auto primary_domain = (browse_mode == nmos::dns_sd_browse_modes::mdns) ? std::string("local.") : browse_domain;
766766
const bool has_fallback = (browse_mode == nmos::dns_sd_browse_modes::both) && !is_local_domain(browse_domain);
767767

768-
// when there's a fallback, give the primary browse half the budget
769-
// so the mDNS fallback gets a meaningful allocation
770-
const auto primary_timeout = has_fallback ? timeout_dur / 2 : timeout_dur;
771-
772-
auto primary_task = resolve_service_(discovery, service, primary_domain, versions, priorities, protocols, authorization, true, primary_timeout, token);
768+
auto primary_task = resolve_service_(discovery, service, primary_domain, versions, priorities, protocols, authorization, true, timeout_dur, token);
773769

774770
if (has_fallback)
775771
{
776-
return primary_task.then([&discovery, service, versions, priorities, protocols, authorization, timeout_dur, primary_timeout, token](std::list<resolved_service> results)
772+
return primary_task.then([&discovery, service, versions, priorities, protocols, authorization, timeout_dur, token](std::list<resolved_service> results)
777773
{
778774
if (!results.empty()) return pplx::task_from_result(std::move(results));
779775

780-
// TR-10-9: unicast DNS unsuccessful, fall back to mDNS
781-
// give the fallback at least as much time as the primary browse had
782-
const auto fallback_timeout = timeout_dur - primary_timeout;
783-
return resolve_service_(discovery, service, std::string("local."), versions, priorities, protocols, authorization, true, fallback_timeout, token);
776+
// TR-10-9: unicast DNS unsuccessful, fall back to mDNS (full timeout per service)
777+
return resolve_service_(discovery, service, std::string("local."), versions, priorities, protocols, authorization, true, timeout_dur, token);
784778
});
785779
}
786780

0 commit comments

Comments
 (0)