From 2ccc0822ffa1fe68ad6d2ef13e3ecfd9b500c66f Mon Sep 17 00:00:00 2001 From: Sage King Date: Sat, 6 Aug 2022 15:13:00 -0600 Subject: [PATCH] Reduced latency when leaving NetPlayServer by adjusting timeout values on enet_host_service calls --- Source/Core/Core/NetPlayServer.cpp | 2 +- Source/Core/DolphinQt/NetPlay/NetPlayDialog.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index c44af173ba..8ff1c1d77b 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -264,7 +264,7 @@ void NetPlayServer::ThreadFunc() int net; if (m_traversal_client) m_traversal_client->HandleResends(); - net = enet_host_service(m_server, &netEvent, 1000); + net = enet_host_service(m_server, &netEvent, 100); while (!m_async_queue.Empty()) { { diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h index 03111925bd..2e1f3dc282 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.h @@ -3,6 +3,7 @@ #pragma once +#include #include #include #include @@ -171,7 +172,7 @@ private: bool m_is_copy_button_retry = false; bool m_got_stop_request = true; int m_buffer_size = 0; - int m_player_count = 0; + std::atomic m_player_count = 0; int m_old_player_count = 0; bool m_host_input_authority = false;