summaryrefslogtreecommitdiff
path: root/Source/Core/Common/TraversalServer.cpp
diff options
context:
space:
mode:
authorActs1631 <acts1631kjv@proton.me>2026-08-04 11:47:51 -0400
committerActs1631 <acts1631kjv@proton.me>2026-09-27 19:06:43 -0400
commit93097f65ea9ae8c2c9c85481ba2cf7d0139480cb (patch)
tree40c23a670bbd6643e0a15400f28632dbfa8ec830 /Source/Core/Common/TraversalServer.cpp
parentbb3558a70ecb767ca59c23bbe06fb6bcb78cd3bd (diff)
Traversal: update pending-packet time on socket timeout
Pending traversal packets were only expired after receive events. If a client did not acknowledge a response and no more packets arrived, the server retained the pending entry indefinitely. Update the current time before handling socket timeouts. Pending packets will then retry and expire while the server is idle.
Diffstat (limited to 'Source/Core/Common/TraversalServer.cpp')
-rw-r--r--Source/Core/Common/TraversalServer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/Core/Common/TraversalServer.cpp b/Source/Core/Common/TraversalServer.cpp
index d1a93793a2..262bb22a70 100644
--- a/Source/Core/Common/TraversalServer.cpp
+++ b/Source/Core/Common/TraversalServer.cpp
@@ -470,6 +470,9 @@ int main()
FD_SET(sock, &readSet);
FD_SET(sockAlt, &readSet);
rv = select(std::max(sock, sockAlt) + 1, &readSet, nullptr, nullptr, &tv);
+ currentTime = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::steady_clock::now().time_since_epoch())
+ .count();
if (rv < 0)
{
if (errno != EINTR && errno != EAGAIN)
@@ -499,9 +502,6 @@ int main()
// note: switch to recvmmsg (yes, mmsg) if this becomes
// expensive
rv = recvfrom(recvsock, &packet, sizeof(packet), 0, (sockaddr*)&raddr, &addrLen);
- currentTime = std::chrono::duration_cast<std::chrono::microseconds>(
- std::chrono::system_clock::now().time_since_epoch())
- .count();
if (rv < 0)
{
if (errno != EINTR && errno != EAGAIN)