From 58a57cc91b93f1b55e1aa409540604396e057bd9 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Sat, 27 Feb 2021 16:29:40 -0500 Subject: [PATCH] Fix coding mistake in networking socket receive functions. --- dll/steam_networking_sockets.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/steam_networking_sockets.h b/dll/steam_networking_sockets.h index 82acd51d..0ecd2711 100644 --- a/dll/steam_networking_sockets.h +++ b/dll/steam_networking_sockets.h @@ -793,7 +793,7 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa std::lock_guard lock(global_mutex); SteamNetworkingMessage_t *msg = NULL; int messages = 0; - while ((msg = get_steam_message_connection(hConn)) && messages < nMaxMessages) { + while (messages < nMaxMessages && (msg = get_steam_message_connection(hConn))) { ppOutMessages[messages] = msg; ++messages; } @@ -821,7 +821,7 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe auto socket_conn = std::begin(connect_sockets); while (socket_conn != std::end(connect_sockets) && messages < nMaxMessages) { if (socket_conn->second.listen_socket_id == hSocket) { - while ((msg = get_steam_message_connection(socket_conn->first)) && messages < nMaxMessages) { + while (messages < nMaxMessages && (msg = get_steam_message_connection(socket_conn->first))) { ppOutMessages[messages] = msg; ++messages; } @@ -1197,7 +1197,7 @@ int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMe int messages = 0; for (auto c : group->second) { - while ((msg = get_steam_message_connection(c)) && messages < nMaxMessages) { + while (messages < nMaxMessages && (msg = get_steam_message_connection(c))) { ppOutMessages[messages] = msg; ++messages; }