Skip to content

Commit b059c10

Browse files
committed
Revert "MinMDNS - do not ask for IP addresses for every SRV record that is seen (project-chip#33119)"
This reverts commit 530dec2. Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent 2cbb715 commit b059c10

4 files changed

+5
-56
lines changed

src/lib/dnssd/ActiveResolveAttempts.cpp

+2-26
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include <lib/support/logging/CHIPLogging.h>
2121

22+
#include <algorithm>
23+
2224
using namespace chip;
2325

2426
namespace mdns {
@@ -282,32 +284,6 @@ Optional<ActiveResolveAttempts::ScheduledAttempt> ActiveResolveAttempts::NextSch
282284
return Optional<ScheduledAttempt>::Missing();
283285
}
284286

285-
bool ActiveResolveAttempts::ShouldResolveIpAddress(PeerId peerId) const
286-
{
287-
for (auto & item : mRetryQueue)
288-
{
289-
if (item.attempt.IsEmpty())
290-
{
291-
continue;
292-
}
293-
if (item.attempt.IsBrowse())
294-
{
295-
return true;
296-
}
297-
298-
if (item.attempt.IsResolve())
299-
{
300-
auto & data = item.attempt.ResolveData();
301-
if (data.peerId == peerId)
302-
{
303-
return true;
304-
}
305-
}
306-
}
307-
308-
return false;
309-
}
310-
311287
bool ActiveResolveAttempts::IsWaitingForIpResolutionFor(SerializedQNameIterator hostName) const
312288
{
313289
for (auto & entry : mRetryQueue)

src/lib/dnssd/ActiveResolveAttempts.h

-6
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,6 @@ class ActiveResolveAttempts
288288
/// IP resolution.
289289
bool IsWaitingForIpResolutionFor(SerializedQNameIterator hostName) const;
290290

291-
/// Determines if address resolution for the given peer ID is required
292-
///
293-
/// IP Addresses are required for active operational discovery of specific peers
294-
/// or if an active browse is being performed.
295-
bool ShouldResolveIpAddress(chip::PeerId peerId) const;
296-
297291
/// Check if a browse operation is active for the given discovery type
298292
bool HasBrowseFor(chip::Dnssd::DiscoveryType type) const;
299293

src/lib/dnssd/IncrementalResolve.h

-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#pragma once
1818

1919
#include <lib/dnssd/Resolver.h>
20-
#include <lib/dnssd/Types.h>
2120
#include <lib/dnssd/minimal_mdns/Parser.h>
2221
#include <lib/dnssd/minimal_mdns/RecordData.h>
2322
#include <lib/dnssd/minimal_mdns/core/QName.h>
@@ -105,12 +104,6 @@ class IncrementalResolver
105104

106105
ServiceNameType GetCurrentType() const { return mServiceNameType; }
107106

108-
PeerId OperationalParsePeerId() const
109-
{
110-
VerifyOrReturnValue(IsActiveOperationalParse(), PeerId());
111-
return mSpecificResolutionData.Get<OperationalNodeData>().peerId;
112-
}
113-
114107
/// Start parsing a new record. SRV records are the records we are mainly
115108
/// interested on, after which TXT and A/AAAA are looked for.
116109
///

src/lib/dnssd/Resolver_ImplMinimalMdns.cpp

+3-17
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "Resolver.h"
1919

20+
#include <limits>
21+
2022
#include <lib/core/CHIPConfig.h>
2123
#include <lib/dnssd/ActiveResolveAttempts.h>
2224
#include <lib/dnssd/IncrementalResolve.h>
@@ -371,23 +373,7 @@ void MinMdnsResolver::AdvancePendingResolverStates()
371373

372374
if (missing.Has(IncrementalResolver::RequiredInformationBitFlags::kIpAddress))
373375
{
374-
if (resolver->IsActiveCommissionParse())
375-
{
376-
// Browse wants IP addresses
377-
ScheduleIpAddressResolve(resolver->GetTargetHostName());
378-
}
379-
else if (mActiveResolves.ShouldResolveIpAddress(resolver->OperationalParsePeerId()))
380-
{
381-
// Keep searching for IP addresses if an active resolve needs these IP addresses
382-
// otherwise ignore the data (received a SRV record without IP address, however we do not
383-
// seem interested in it. Probably just a device that came online).
384-
ScheduleIpAddressResolve(resolver->GetTargetHostName());
385-
}
386-
else
387-
{
388-
// This IP address is not interesting enough to run another discovery
389-
resolver->ResetToInactive();
390-
}
376+
ScheduleIpAddressResolve(resolver->GetTargetHostName());
391377
continue;
392378
}
393379

0 commit comments

Comments
 (0)