mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
net: Use mockable steady clock in PCP implementation
This will be needed for the test harness.
This commit is contained in:
parent
03648321ec
commit
caf9521033
1 changed files with 2 additions and 2 deletions
|
@ -235,9 +235,9 @@ std::optional<std::vector<uint8_t>> PCPSendRecv(Sock &sock, const std::string &p
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for response(s) until we get a valid response, a network error, or time out.
|
// Wait for response(s) until we get a valid response, a network error, or time out.
|
||||||
auto cur_time = time_point_cast<milliseconds>(steady_clock::now());
|
auto cur_time = time_point_cast<milliseconds>(MockableSteadyClock::now());
|
||||||
auto deadline = cur_time + timeout_per_try;
|
auto deadline = cur_time + timeout_per_try;
|
||||||
while ((cur_time = time_point_cast<milliseconds>(steady_clock::now())) < deadline) {
|
while ((cur_time = time_point_cast<milliseconds>(MockableSteadyClock::now())) < deadline) {
|
||||||
Sock::Event occurred = 0;
|
Sock::Event occurred = 0;
|
||||||
if (!sock.Wait(deadline - cur_time, Sock::RECV, &occurred)) {
|
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()));
|
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not wait on socket: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue