#include "player.h"
#include "network.h"
+#include "network_msg.h"
+#include "player_remote.h"
static void scores_update(void);
if( info->m_hConn == network_client.remote ){
network_client.state = info->m_info.m_eState;
- if( info->m_info.m_eState == k_ESteamNetworkingConnectionState_Connected ){
+
+ if( info->m_info.m_eState ==
+ k_ESteamNetworkingConnectionState_Connected ){
vg_success(" Connected to remote server.. authenticating\n");
send_auth_ticket();
}
+ else if( info->m_info.m_eState ==
+ k_ESteamNetworkingConnectionState_ClosedByPeer ){
+
+ if( info->m_info.m_eEndReason ==
+ k_ESteamNetConnectionEnd_Remote_Max ){
+ network_client.retries = 40;
+ }
+
+ SteamAPI_ISteamNetworkingSockets_CloseConnection(
+ hSteamNetworkingSockets, info->m_hConn, 0, NULL, 0 );
+ network_client.remote = 0;
+ }
+ else if( info->m_info.m_eState ==
+ k_ESteamNetworkingConnectionState_ProblemDetectedLocally ){
+ SteamAPI_ISteamNetworkingSockets_CloseConnection(
+ hSteamNetworkingSockets, info->m_hConn, 0, NULL, 0 );
+ network_client.remote = 0;
+ }
}
else{
- vg_warn( " Recieved signal from unknown connection\n" );
+ //vg_warn( " Recieved signal from unknown connection\n" );
}
}
}
}
+#if 0
/* We dont need to stay on the server currently */
SteamAPI_ISteamNetworkingSockets_CloseConnection(
hSteamNetworkingSockets, network_client.remote, 0, NULL, 1 );
+#endif
network_scores_updated = 1;
}
if( tmp->inetmsg_id == k_inetmsg_scoreboard )
on_inet_scoreboard( msg );
+ if( (tmp->inetmsg_id >= 200) && (tmp->inetmsg_id < 300) ){
+ player_remote_packet( msg );
+ }
+
SteamAPI_SteamNetworkingMessage_t_Release( msg );
}
}
}
static void network_init(void){
+ vg_console_reg_var( "network_info", &network_client.network_info,
+ k_var_dtype_i32, VG_VAR_PERSISTENT );
if( steam_ready ){
steam_register_callback( k_iSteamNetConnectionStatusChangedCallBack,
on_server_connect_status );