From af4b04ccbcbc3c126e92e90363e46e1af499410f Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sat, 8 Nov 2025 17:18:56 -0500 Subject: [PATCH] feat: enhance polling logic with domain packet reception logging and periodic domain connection retries --- src/OverteClient.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/OverteClient.cpp b/src/OverteClient.cpp index f719193..4ef0ff4 100644 --- a/src/OverteClient.cpp +++ b/src/OverteClient.cpp @@ -181,16 +181,28 @@ void OverteClient::poll() { sockaddr_storage from{}; socklen_t fromlen = sizeof(from); ssize_t r = ::recvfrom(m_udpFd, buf, sizeof(buf), 0, reinterpret_cast(&from), &fromlen); if (r > 0) { + std::cout << "[OverteClient] <<< Received domain packet (" << r << " bytes)" << std::endl; parseDomainPacket(buf, static_cast(r)); + } else if (r < 0 && errno != EWOULDBLOCK && errno != EAGAIN) { + std::cerr << "[OverteClient] UDP recv error: " << strerror(errno) << std::endl; } // Send periodic ping to domain to keep connection alive static auto lastPing = std::chrono::steady_clock::now(); + static auto lastDomainList = std::chrono::steady_clock::now(); auto now = std::chrono::steady_clock::now(); + if (std::chrono::duration_cast(now - lastPing).count() >= 1) { sendPing(m_udpFd, m_udpAddr, m_udpAddrLen); lastPing = now; } + + // Request domain list periodically if not connected + if (!m_domainConnected && std::chrono::duration_cast(now - lastDomainList).count() >= 2) { + std::cout << "[OverteClient] Retrying domain connection..." << std::endl; + sendDomainConnectRequest(); + lastDomainList = now; + } } // Parse entity server packets