X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=network.c;h=a35ead4ef3a6004403c9c78d139ef345f426e127;hb=71aba6c4108d99f39379f54b04bb71a6d2dc09b5;hp=8b34fb092a9668a820dc662e2d20846769af77e7;hpb=b1f5771eda7a9788b86604a4368eb83babdf486d;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/network.c b/network.c index 8b34fb0..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{ @@ -233,6 +238,8 @@ static void network_connect(void){ const char *server_lon1 = "46.101.34.155:27402"; SteamAPI_SteamNetworkingIPAddr_ParseString( &remoteAddr, server_lon1 ); #endif + const char *server_lan = "192.168.1.32:27402"; + SteamAPI_SteamNetworkingIPAddr_ParseString( &remoteAddr, server_lan ); char buf[256]; SteamAPI_SteamNetworkingIPAddr_ToString( &remoteAddr, buf, 256, 1 );