Skip to content

Commit

Permalink
restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
kpschoedel committed Oct 27, 2021
1 parent 1b0fda0 commit 2c78c1b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
7 changes: 3 additions & 4 deletions src/lib/dnssd/minimal_mdns/ActiveResolveAttempts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ void ActiveResolveAttempts::MarkPending(const PeerId & peerId)
{
entryToUse = entry;
}
else if ((entry->nextRetryDelay == entryToUse->nextRetryDelay) &&
(entry->queryDueTime < entryToUse->queryDueTime))
else if ((entry->nextRetryDelay == entryToUse->nextRetryDelay) && (entry->queryDueTime < entryToUse->queryDueTime))
{
entryToUse = entry;
}
Expand All @@ -119,8 +118,8 @@ void ActiveResolveAttempts::MarkPending(const PeerId & peerId)
ChipLogError(Discovery, "Re-using pending resolve entry before reply was received.");
}

entryToUse->peerId = peerId;
entryToUse->queryDueTime = mClock->GetMonotonicTimestamp();
entryToUse->peerId = peerId;
entryToUse->queryDueTime = mClock->GetMonotonicTimestamp();
entryToUse->nextRetryDelay = System::Clock::Seconds16(1);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/dnssd/minimal_mdns/ActiveResolveAttempts.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Minimal {
class ActiveResolveAttempts
{
public:
static constexpr size_t kRetryQueueSize = 4;
static constexpr size_t kRetryQueueSize = 4;
static constexpr chip::System::Clock::Timeout kMaxRetryDelay = chip::System::Clock::Seconds16(16);

ActiveResolveAttempts(chip::System::Clock::ClockBase * clock) : mClock(clock) { Reset(); }
Expand Down
12 changes: 6 additions & 6 deletions src/lib/dnssd/minimal_mdns/responders/QueryResponder.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ namespace Minimal {
/// Represents available data (replies) for mDNS queries.
struct QueryResponderRecord
{
Responder * responder = nullptr; // what response/data is available
bool reportService = false; // report as a service when listing dnssd services
chip::System::Clock::Timestamp lastMulticastTime { 0 }; // last time this record was multicast
Responder * responder = nullptr; // what response/data is available
bool reportService = false; // report as a service when listing dnssd services
chip::System::Clock::Timestamp lastMulticastTime{ 0 }; // last time this record was multicast
};

namespace Internal {
Expand Down Expand Up @@ -154,9 +154,9 @@ class QueryResponderRecordFilter
}

private:
bool mIncludeAdditionalRepliesOnly = false;
ReplyFilter * mReplyFilter = nullptr;
chip::System::Clock::Timestamp mIncludeOnlyMulticastBefore { 0 };
bool mIncludeAdditionalRepliesOnly = false;
ReplyFilter * mReplyFilter = nullptr;
chip::System::Clock::Timestamp mIncludeOnlyMulticastBefore{ 0 };
};

/// Iterates over an array of QueryResponderRecord items, providing only 'valid' ones, where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ void TestLRU(nlTestSuite * inSuite, void * inContext)
}

// +2 because: 1 element skipped, one element is the "current" that has a delay of 1000ms
NL_TEST_ASSERT(
inSuite,
attempts.GetTimeUntilNextExpectedResponse() ==
Optional<System::Clock::Timeout>::Value(System::Clock::Milliseconds32(1000 - mdns::Minimal::ActiveResolveAttempts::kRetryQueueSize + 2)));
NL_TEST_ASSERT(inSuite,
attempts.GetTimeUntilNextExpectedResponse() ==
Optional<System::Clock::Timeout>::Value(
System::Clock::Milliseconds32(1000 - mdns::Minimal::ActiveResolveAttempts::kRetryQueueSize + 2)));

// add another element - this should overwrite peer 9999
attempts.MarkPending(MakePeerId(mdns::Minimal::ActiveResolveAttempts::kRetryQueueSize));
Expand Down

0 comments on commit 2c78c1b

Please sign in to comment.