From caf952103317a7fa8bd2bceb35d4e8ace5968906 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:26:21 +0200 Subject: [PATCH] net: Use mockable steady clock in PCP implementation This will be needed for the test harness. --- src/common/pcp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/pcp.cpp b/src/common/pcp.cpp index 7fbc1472b4e..111a8e69d40 100644 --- a/src/common/pcp.cpp +++ b/src/common/pcp.cpp @@ -235,9 +235,9 @@ std::optional> PCPSendRecv(Sock &sock, const std::string &p } // Wait for response(s) until we get a valid response, a network error, or time out. - auto cur_time = time_point_cast(steady_clock::now()); + auto cur_time = time_point_cast(MockableSteadyClock::now()); auto deadline = cur_time + timeout_per_try; - while ((cur_time = time_point_cast(steady_clock::now())) < deadline) { + while ((cur_time = time_point_cast(MockableSteadyClock::now())) < deadline) { Sock::Event occurred = 0; if (!sock.Wait(deadline - cur_time, Sock::RECV, &occurred)) { LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not wait on socket: %s\n", protocol, NetworkErrorString(WSAGetLastError()));