Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and nivi-apple committed Mar 21, 2024
1 parent 2ad1506 commit d5ca8db
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
37 changes: 19 additions & 18 deletions src/platform/Darwin/DnssdContexts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,29 +458,30 @@ ResolveContext::ResolveContext(void * cbContext, DnssdResolveCallback cb, chip::
std::shared_ptr<uint32_t> && consumerCounterToUse) :
browseThatCausedResolve(browseCausingResolve)
{
type = ContextType::Resolve;
context = cbContext;
callback = cb;
protocol = GetProtocol(cbAddressType);
instanceName = instanceNameToResolve;
consumerCounter = std::move(consumerCounterToUse);
type = ContextType::Resolve;
context = cbContext;
callback = cb;
protocol = GetProtocol(cbAddressType);
instanceName = instanceNameToResolve;
consumerCounter = std::move(consumerCounterToUse);
hasSrpTimerStarted = false;
}

ResolveContext::ResolveContext(CommissioningResolveDelegate * delegate, chip::Inet::IPAddressType cbAddressType,
const char * instanceNameToResolve, std::shared_ptr<uint32_t> && consumerCounterToUse) :
browseThatCausedResolve(nullptr)
{
type = ContextType::Resolve;
context = delegate;
callback = nullptr;
protocol = GetProtocol(cbAddressType);
instanceName = instanceNameToResolve;
consumerCounter = std::move(consumerCounterToUse);
type = ContextType::Resolve;
context = delegate;
callback = nullptr;
protocol = GetProtocol(cbAddressType);
instanceName = instanceNameToResolve;
consumerCounter = std::move(consumerCounterToUse);
hasSrpTimerStarted = false;
}

ResolveContext::~ResolveContext() {
ResolveContext::~ResolveContext()
{
if (this->hasSrpTimerStarted)
{
CancelSrpTimer(this);
Expand Down Expand Up @@ -576,13 +577,13 @@ bool ResolveContext::TryReportingResultsForInterfaceIndex(uint32_t interfaceInde
}

std::map<std::pair<uint32_t, std::string>, InterfaceInfo>::iterator iter = interfaces.begin();
while (iter != interfaces.end())
{
std::pair<uint32_t, std::string> key = iter->first;
while (iter != interfaces.end())
{
std::pair<uint32_t, std::string> key = iter->first;
if (key.first == interfaceIndex)
{
auto & interface = interfaces[key];
auto & ips = interface.addresses;
auto & interface = interfaces[key];
auto & ips = interface.addresses;

// Some interface may not have any ips, just ignore them.
if (ips.size() == 0)
Expand Down
14 changes: 6 additions & 8 deletions src/platform/Darwin/DnssdImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ CHIP_ERROR StartSrpTimer(uint16_t timeoutInMSecs, ResolveContext * ctx)
{
VerifyOrReturnValue(ctx != nullptr, CHIP_ERROR_INCORRECT_STATE);
return DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds16(timeoutInMSecs), SrpTimerExpiredCallback,
reinterpret_cast<void *>(ctx));
reinterpret_cast<void *>(ctx));
}

/**
Expand All @@ -195,7 +195,6 @@ void CancelSrpTimer(ResolveContext * ctx)
DeviceLayer::SystemLayer().CancelTimer(SrpTimerExpiredCallback, reinterpret_cast<void *>(ctx));
}


Global<MdnsContexts> MdnsContexts::sInstance;

namespace {
Expand Down Expand Up @@ -261,7 +260,7 @@ CHIP_ERROR Browse(BrowseHandler * sdCtx, uint32_t interfaceId, const char * type
ChipLogProgress(Discovery, "Browsing for: %s on domain %s", StringOrNullMarker(type), kSrpDot);

auto sdRefSrp = sdCtx->serviceRef; // Mandatory copy because of kDNSServiceFlagsShareConnection
err = DNSServiceBrowse(&sdRefSrp, kBrowseFlags, interfaceId, type, kSrpDot, OnBrowse, sdCtx);
err = DNSServiceBrowse(&sdRefSrp, kBrowseFlags, interfaceId, type, kSrpDot, OnBrowse, sdCtx);
VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err));

return MdnsContexts::GetInstance().Add(sdCtx, sdCtx->serviceRef);
Expand Down Expand Up @@ -323,9 +322,8 @@ static void OnGetAddrInfo(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t i
}
else if (domainName.compare(kLocalDot) == 0)
{
ChipLogProgress(
Discovery,
"Mdns: Resolve completed on the local domain. Starting a timer for the srp resolve to come back");
ChipLogProgress(Discovery,
"Mdns: Resolve completed on the local domain. Starting a timer for the srp resolve to come back");

// Usually the resolution on the local domain is quicker than on the srp domain. We would like to give the
// resolution on the srp domain around 250 millisecs more to give it a chance to resolve before finalizing
Expand Down Expand Up @@ -383,7 +381,7 @@ static void OnResolve(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t inter
if (!sdCtx->isResolveRequested)
{
GetAddrInfo(sdCtx);
sdCtx->isResolveRequested = true;
sdCtx->isResolveRequested = true;
}
}
}
Expand All @@ -403,7 +401,7 @@ static CHIP_ERROR Resolve(ResolveContext * sdCtx, uint32_t interfaceId, chip::In
VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err));

auto sdRefSrp = sdCtx->serviceRef; // Mandatory copy because of kDNSServiceFlagsShareConnection
err = DNSServiceResolve(&sdRefSrp, kResolveFlags, interfaceId, name, type, kSrpDot, OnResolve, sdCtx);
err = DNSServiceResolve(&sdRefSrp, kResolveFlags, interfaceId, name, type, kSrpDot, OnResolve, sdCtx);
VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err));

auto retval = MdnsContexts::GetInstance().Add(sdCtx, sdCtx->serviceRef);
Expand Down

0 comments on commit d5ca8db

Please sign in to comment.