Fixed potential bug. Thanks to Nemirtingas for finding it.

merge-requests/32/head
Mr_Goldberg 2020-06-23 07:19:45 -04:00
parent 02ee5f9a6d
commit d531e27ac0
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
1 changed files with 2 additions and 1 deletions

View File

@ -149,8 +149,9 @@ void remove_connection(CSteamID id)
SNetSocket_t create_connection_socket(CSteamID target, int nVirtualPort, uint32 nIP, uint16 nPort, SNetListenSocket_t id=0, enum steam_socket_connection_status status=SOCKET_CONNECTING, SNetSocket_t other_id=0) SNetSocket_t create_connection_socket(CSteamID target, int nVirtualPort, uint32 nIP, uint16 nPort, SNetListenSocket_t id=0, enum steam_socket_connection_status status=SOCKET_CONNECTING, SNetSocket_t other_id=0)
{ {
static SNetSocket_t socket_number = 0; static SNetSocket_t socket_number = 0;
bool found = 0; bool found;
do { do {
found = false;
++socket_number; ++socket_number;
for (auto & c: connection_sockets) { for (auto & c: connection_sockets) {
if (c.id == socket_number || socket_number == 0) { if (c.id == socket_number || socket_number == 0) {