X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=inline;f=network.c;h=a35ead4ef3a6004403c9c78d139ef345f426e127;hb=71aba6c4108d99f39379f54b04bb71a6d2dc09b5;hp=4042ef4ef3dd1f5882617141c63f15a555e00b22;hpb=5fba3602f053116a8e3849bc12c03198d6d7461c;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/network.c b/network.c index 4042ef4..a35ead4 100644 --- a/network.c +++ b/network.c @@ -157,6 +157,16 @@ static void network_send_username(void){ k_nSteamNetworkingSend_Reliable, NULL ); } +static void network_disconnect(void){ + SteamAPI_ISteamNetworkingSockets_CloseConnection( + hSteamNetworkingSockets, network_client.remote, 0, NULL, 0 ); + network_client.remote = 0; + + for( int i=0; im_pubParam; vg_info( " Connection status changed for %lu\n", info->m_hConn ); @@ -193,16 +203,11 @@ static void on_server_connect_status( CallbackMsg_t *msg ){ k_ESteamNetConnectionEnd_Remote_Max ){ network_client.retries = 40; } - - SteamAPI_ISteamNetworkingSockets_CloseConnection( - hSteamNetworkingSockets, info->m_hConn, 0, NULL, 0 ); - network_client.remote = 0; + network_disconnect(); } else if( info->m_info.m_eState == k_ESteamNetworkingConnectionState_ProblemDetectedLocally ){ - SteamAPI_ISteamNetworkingSockets_CloseConnection( - hSteamNetworkingSockets, info->m_hConn, 0, NULL, 0 ); - network_client.remote = 0; + network_disconnect(); } } else{