mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-27 14:08:39 +01:00
Listen socket ids should be different from connection socket ids.
This commit is contained in:
parent
37b329c9c5
commit
9a63cf868d
1 changed files with 8 additions and 4 deletions
|
@ -107,11 +107,16 @@ Steam_Networking_Sockets(class Settings *settings, class Networking *network, cl
|
||||||
this->run_every_runcb->remove(&Steam_Networking_Sockets::steam_run_every_runcb, this);
|
this->run_every_runcb->remove(&Steam_Networking_Sockets::steam_run_every_runcb, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long get_socket_id()
|
||||||
|
{
|
||||||
|
static unsigned long socket_id;
|
||||||
|
socket_id++;
|
||||||
|
return socket_id;
|
||||||
|
}
|
||||||
|
|
||||||
HSteamListenSocket new_listen_socket(int nSteamConnectVirtualPort)
|
HSteamListenSocket new_listen_socket(int nSteamConnectVirtualPort)
|
||||||
{
|
{
|
||||||
static HSteamListenSocket socket_id;
|
HSteamListenSocket socket_id = get_socket_id();
|
||||||
++socket_id;
|
|
||||||
if (socket_id == k_HSteamListenSocket_Invalid) ++socket_id;
|
if (socket_id == k_HSteamListenSocket_Invalid) ++socket_id;
|
||||||
|
|
||||||
auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&nSteamConnectVirtualPort](struct Listen_Socket const& conn) { return conn.virtual_port == nSteamConnectVirtualPort;});
|
auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&nSteamConnectVirtualPort](struct Listen_Socket const& conn) { return conn.virtual_port == nSteamConnectVirtualPort;});
|
||||||
|
@ -165,8 +170,7 @@ HSteamNetConnection new_connect_socket(SteamNetworkingIdentity remote_identity,
|
||||||
socket.user_data = -1;
|
socket.user_data = -1;
|
||||||
socket.poll_group = k_HSteamNetPollGroup_Invalid;
|
socket.poll_group = k_HSteamNetPollGroup_Invalid;
|
||||||
|
|
||||||
static HSteamNetConnection socket_id;
|
HSteamNetConnection socket_id = get_socket_id();
|
||||||
++socket_id;
|
|
||||||
if (socket_id == k_HSteamNetConnection_Invalid) ++socket_id;
|
if (socket_id == k_HSteamNetConnection_Invalid) ++socket_id;
|
||||||
|
|
||||||
if (connect_sockets.insert(std::make_pair(socket_id, socket)).second == false) {
|
if (connect_sockets.insert(std::make_pair(socket_id, socket)).second == false) {
|
||||||
|
|
Loading…
Reference in a new issue