Skip to content

Commit caf9521

Browse files
committed
net: Use mockable steady clock in PCP implementation
This will be needed for the test harness.
1 parent 0364832 commit caf9521

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/pcp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ std::optional<std::vector<uint8_t>> PCPSendRecv(Sock &sock, const std::string &p
235235
}
236236

237237
// Wait for response(s) until we get a valid response, a network error, or time out.
238-
auto cur_time = time_point_cast<milliseconds>(steady_clock::now());
238+
auto cur_time = time_point_cast<milliseconds>(MockableSteadyClock::now());
239239
auto deadline = cur_time + timeout_per_try;
240-
while ((cur_time = time_point_cast<milliseconds>(steady_clock::now())) < deadline) {
240+
while ((cur_time = time_point_cast<milliseconds>(MockableSteadyClock::now())) < deadline) {
241241
Sock::Event occurred = 0;
242242
if (!sock.Wait(deadline - cur_time, Sock::RECV, &occurred)) {
243243
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not wait on socket: %s\n", protocol, NetworkErrorString(WSAGetLastError()));

0 commit comments

Comments
 (0)