2 #include "vg/vg_steam.h"
3 #include "vg/vg_steam_networking.h"
4 #include "vg/vg_steam_auth.h"
5 #include "vg/vg_steam_friends.h"
8 #include "network_msg.h"
9 #include "network_common.h"
10 #include "player_remote.h"
12 #include "world_sfd.h"
13 #include "world_routes.h"
14 #include "vg/vg_imgui.h"
16 #include "ent_region.h"
17 #include "vg/vg_loader.h"
19 #include <sys/socket.h>
20 #include <sys/types.h>
23 struct network_client network_client
=
25 .auth_mode
= eServerModeAuthentication
,
26 .state
= k_ESteamNetworkingConnectionState_None
,
27 .last_intent_change
= -99999.9
30 static void scores_update(void);
32 int packet_minsize( SteamNetworkingMessage_t
*msg
, u32 size
){
33 if( msg
->m_cbSize
< size
) {
34 vg_error( "Invalid packet size (must be at least %u)\n", size
);
42 static void on_auth_ticket_recieved( void *result
, void *context
){
43 EncryptedAppTicketResponse_t
*response
= result
;
45 if( response
->m_eResult
== k_EResultOK
){
46 vg_info( " New app ticket ready\n" );
49 vg_warn( " Could not request new encrypted app ticket (%u)\n",
50 response
->m_eResult
);
53 if( SteamAPI_ISteamUser_GetEncryptedAppTicket( hSteamUser
,
54 network_client
.app_symmetric_key
,
55 vg_list_size(network_client
.app_symmetric_key
),
56 &network_client
.app_key_length
)){
57 vg_success( " Loaded app ticket\n" );
60 vg_error( " No ticket availible\n" );
61 network_client
.app_key_length
= 0;
65 static void request_auth_ticket(void){
67 * TODO Check for one thats cached on the disk and load it.
68 * This might be OK though because steam seems to cache the result
71 vg_info( "Requesting new authorization ticket\n" );
73 vg_steam_async_call
*call
= vg_alloc_async_steam_api_call();
74 call
->userdata
= NULL
;
75 call
->p_handler
= on_auth_ticket_recieved
;
77 SteamAPI_ISteamUser_RequestEncryptedAppTicket( hSteamUser
, NULL
, 0 );
80 static void network_send_username(void){
81 if( !network_connected() )
84 netmsg_playerusername
*update
= alloca( sizeof(netmsg_playerusername
)+
85 NETWORK_USERNAME_MAX
);
86 update
->inetmsg_id
= k_inetmsg_playerusername
;
89 ISteamFriends
*hSteamFriends
= SteamAPI_SteamFriends();
90 const char *username
= SteamAPI_ISteamFriends_GetPersonaName(hSteamFriends
);
91 u32 chs
= str_utf8_collapse( username
, update
->name
, NETWORK_USERNAME_MAX
);
93 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
94 hSteamNetworkingSockets
, network_client
.remote
,
95 update
, sizeof(netmsg_playerusername
)+chs
+1,
96 k_nSteamNetworkingSend_Reliable
, NULL
);
99 void network_send_region(void)
101 if( !network_connected() )
104 netmsg_region
*region
= alloca( sizeof(netmsg_region
) + NETWORK_REGION_MAX
);
106 region
->inetmsg_id
= k_inetmsg_region
;
108 region
->flags
= global_ent_region
.flags
;
110 u32 l
= vg_strncpy( global_ent_region
.location
, region
->loc
,
111 NETWORK_REGION_MAX
, k_strncpy_always_add_null
);
113 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
114 hSteamNetworkingSockets
, network_client
.remote
,
115 region
, sizeof(netmsg_region
)+l
+1,
116 k_nSteamNetworkingSend_Reliable
, NULL
);
119 static void network_send_request( netmsg_request
*req
, vg_msg
*body
,
121 netmsg_request
*res
, vg_msg
*body
,
127 vg_info( "Request scoreboard. Info (%u):\n", body
->cur
.co
);
128 vg_msg_print( body
, len
);
130 if( body
->error
!= k_vg_msg_error_OK
){
131 vg_error( "Body not OK\n" );
137 req
->id
= vg_pool_lru( &network_client
.request_pool
);
139 vg_pool_watch( &network_client
.request_pool
, req
->id
);
140 struct network_request
*pn
=
141 vg_pool_item( &network_client
.request_pool
, req
->id
);
142 pn
->callback
= callback
;
143 pn
->sendtime
= vg
.time_real
;
144 pn
->userdata
= userdata
;
147 vg_error( "Unable to send request. Pool is full.\n" );
154 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
155 hSteamNetworkingSockets
, network_client
.remote
,
156 req
, sizeof(netmsg_request
)+len
,
157 k_nSteamNetworkingSend_Reliable
, NULL
);
160 static void network_scoreboard_callback( netmsg_request
*res
, vg_msg
*body
,
162 world_instance
*world
= world_current_instance();
164 world_routes_recv_scoreboard( world
, body
, userdata
, res
->status
);
165 if( userdata
== world_sfd
.active_route_board
)
166 world_sfd_compile_active_scores();
171 /* mod_uid: world mod uid,
172 * route_uid: run name (just a string)
176 * 2 ALL TIME + CURRENT WEEK
178 * 10+ specific week index
180 void network_request_scoreboard( const char *mod_uid
,
181 const char *route_uid
,
182 u32 week
, u64 userdata
){
183 if( !network_connected() )
186 netmsg_request
*req
= alloca( sizeof(netmsg_request
) + 512 );
187 req
->inetmsg_id
= k_inetmsg_request
;
190 vg_msg_init( &data
, req
->q
, 512 );
191 vg_msg_wkvstr( &data
, "endpoint", "scoreboard" );
192 vg_msg_wkvstr( &data
, "mod", mod_uid
);
193 vg_msg_wkvstr( &data
, "route", route_uid
);
194 vg_msg_wkvnum( &data
, "week", k_vg_msg_u32
, 1, &week
);
195 network_send_request( req
, &data
, network_scoreboard_callback
, userdata
);
198 static void network_publish_callback( netmsg_request
*res
, vg_msg
*body
,
200 if( res
->status
!= k_request_status_ok
){
201 vg_error( "Publish laptime, server error #%d\n", (i32
)res
->status
);
205 void network_publish_laptime( const char *mod_uid
,
206 const char *route_uid
, f64 lap_time
){
207 if( !network_connected() )
210 i32 time_centiseconds
= lap_time
* 100.0;
212 netmsg_request
*req
= alloca( sizeof(netmsg_request
) + 512 );
213 req
->inetmsg_id
= k_inetmsg_request
;
216 vg_msg_init( &data
, req
->q
, 512 );
217 vg_msg_wkvstr( &data
, "endpoint", "setlap" );
218 vg_msg_wkvstr( &data
, "mod", mod_uid
);
219 vg_msg_wkvstr( &data
, "route", route_uid
);
220 vg_msg_wkvnum( &data
, "time", k_vg_msg_i32
, 1, &time_centiseconds
);
221 network_send_request( req
, &data
, network_publish_callback
, 0 );
224 static void network_request_rx_300_400( SteamNetworkingMessage_t
*msg
){
225 netmsg_blank
*tmp
= msg
->m_pData
;
227 if( tmp
->inetmsg_id
== k_inetmsg_request
){
230 else if( tmp
->inetmsg_id
== k_inetmsg_response
){
231 netmsg_request
*res
= (netmsg_request
*)msg
->m_pData
;
236 if( res
->status
== k_request_status_ok
){
237 vg_msg_init( &data
, res
->q
, msg
->m_cbSize
- sizeof(netmsg_request
) );
238 vg_success( "Response to #%d:\n", (i32
)res
->id
);
239 vg_msg_print( &data
, data
.max
);
243 vg_warn( "Server response to #%d: %d\n", (i32
)res
->id
, res
->status
);
247 struct network_request
*pn
=
248 vg_pool_item( &network_client
.request_pool
, res
->id
);
249 pn
->callback( res
, body
, pn
->userdata
);
250 vg_pool_unwatch( &network_client
.request_pool
, res
->id
);
255 void network_send_item( enum netmsg_playeritem_type type
)
257 if( !network_connected() )
260 netmsg_playeritem
*item
=
261 alloca( sizeof(netmsg_playeritem
) + ADDON_UID_MAX
);
262 item
->inetmsg_id
= k_inetmsg_playeritem
;
263 item
->type_index
= type
;
266 if( (type
== k_netmsg_playeritem_world0
) ||
267 (type
== k_netmsg_playeritem_world1
) ){
269 enum world_purpose purpose
= type
- k_netmsg_playeritem_world0
;
270 addon_reg
*reg
= world_static
.instance_addons
[ purpose
];
273 addon_alias_uid( ®
->alias
, item
->uid
);
279 enum addon_type addon_type
= k_addon_type_none
;
280 if( type
== k_netmsg_playeritem_board
){
281 view_id
= localplayer
.board_view_slot
;
282 addon_type
= k_addon_type_board
;
284 else if( type
== k_netmsg_playeritem_player
){
285 view_id
= localplayer
.playermodel_view_slot
;
286 addon_type
= k_addon_type_player
;
289 struct addon_cache
*cache
= &addon_system
.cache
[addon_type
];
290 vg_pool
*pool
= &cache
->pool
;
292 SDL_AtomicLock( &addon_system
.sl_cache_using_resources
);
293 addon_cache_entry
*entry
= vg_pool_item( pool
, view_id
);
294 addon_alias_uid( &entry
->reg_ptr
->alias
, item
->uid
);
295 SDL_AtomicUnlock( &addon_system
.sl_cache_using_resources
);
298 vg_info( "send equip: [%u] %s\n",
299 item
->type_index
, item
->uid
);
300 u32 chs
= strlen(item
->uid
);
302 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
303 hSteamNetworkingSockets
, network_client
.remote
,
304 item
, sizeof(netmsg_playeritem
)+chs
+1,
305 k_nSteamNetworkingSend_Reliable
, NULL
);
308 static void network_disconnect(void){
309 SteamAPI_ISteamNetworkingSockets_CloseConnection(
310 hSteamNetworkingSockets
, network_client
.remote
, 0, NULL
, 0 );
311 network_client
.remote
= 0;
312 network_client
.state
= k_ESteamNetworkingConnectionState_None
;
314 for( int i
=0; i
<vg_list_size(netplayers
.list
); i
++ ){
315 netplayers
.list
[i
].active
= 0;
319 void network_status_string( vg_str
*str
, u32
*colour
)
321 if( skaterift
.demo_mode
){
322 vg_strcat( str
, "Offline" );
327 if( network_client
.user_intent
== k_server_intent_offline
){
328 vg_strcat( str
, "Offline" );
331 ESteamNetworkingConnectionState state
= network_client
.state
;
333 if( state
== k_ESteamNetworkingConnectionState_None
)
334 vg_strcat( str
, "No Connection" );
335 else if( state
== k_ESteamNetworkingConnectionState_Connecting
)
337 vg_strcatf( str
, "Connecting...\n%s", network_client
.host_adress
);
339 if( network_client
.retries
){
340 vg_strcat( str
, "\n(" );
341 vg_strcati32( str
, network_client
.retries
);
342 vg_strcat( str
, " retries)" );
345 else if( state
== k_ESteamNetworkingConnectionState_Connected
){
346 vg_strcatf( str
, "Connected to:\n%s", network_client
.host_adress
);
347 *colour
= 0xff00a020;
349 else if( state
== k_ESteamNetworkingConnectionState_ClosedByPeer
)
350 vg_strcat( str
, "Connection Closed" );
351 else if( state
== k_ESteamNetworkingConnectionState_FindingRoute
)
352 vg_strcat( str
, "Finding Route" );
354 k_ESteamNetworkingConnectionState_ProblemDetectedLocally
){
355 vg_strcat( str
, "Problem Detected\nLocally" );
356 *colour
= 0xff0000a0;
359 vg_strcat( str
, "???" );
363 vg_strcat( str
, "Steam Offline" );
364 *colour
= 0xff0000a0;
368 void render_server_status_gui(void)
370 render_fb_bind( gpipeline
.fb_workshop_preview
, 0 );
374 vg_ui
.cur_indice
= 0;
375 vg_ui
.vert_start
= 0;
376 vg_ui
.indice_start
= 0;
378 ui_rect r
= { 0, 0, 128, 48 };
382 vg_strnull( &str
, buf
, sizeof(buf
) );
385 network_status_string( &str
, &bg
);
388 ui_text( r
, buf
, 1, k_ui_align_center
, 0 );
389 ui_flush( k_ui_shader_colour
, 128, 48 );
391 skaterift
.rt_textures
[ k_skaterift_rt_server_status
] =
392 gpipeline
.fb_workshop_preview
->attachments
[0].id
;
395 static void on_server_connect_status( CallbackMsg_t
*msg
){
396 SteamNetConnectionStatusChangedCallback_t
*info
= (void *)msg
->m_pubParam
;
397 vg_info( " Connection status changed for %lu\n", info
->m_hConn
);
398 vg_info( " %s -> %s\n",
399 string_ESteamNetworkingConnectionState(info
->m_eOldState
),
400 string_ESteamNetworkingConnectionState(info
->m_info
.m_eState
) );
402 if( info
->m_hConn
== network_client
.remote
){
403 network_client
.state
= info
->m_info
.m_eState
;
405 if( info
->m_info
.m_eState
==
406 k_ESteamNetworkingConnectionState_Connected
){
407 vg_success(" Connected to remote server.. authenticating\n");
409 /* send version info to server */
410 netmsg_version version
;
411 version
.inetmsg_id
= k_inetmsg_version
;
412 version
.version
= NETWORK_SKATERIFT_VERSION
;
413 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
414 hSteamNetworkingSockets
, network_client
.remote
, &version
,
415 sizeof(netmsg_version
), k_nSteamNetworkingSend_Reliable
, NULL
);
417 /* TODO: We should really wait to see if the server is in auth mode
419 u32 size
= sizeof(netmsg_auth
) + network_client
.app_key_length
;
420 netmsg_auth
*auth
= alloca(size
);
421 auth
->inetmsg_id
= k_inetmsg_auth
;
422 auth
->ticket_length
= network_client
.app_key_length
;
423 for( int i
=0; i
<network_client
.app_key_length
; i
++ )
424 auth
->ticket
[i
] = network_client
.app_symmetric_key
[i
];
426 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
427 hSteamNetworkingSockets
, network_client
.remote
, auth
, size
,
428 k_nSteamNetworkingSend_Reliable
, NULL
);
430 else if( info
->m_info
.m_eState
==
431 k_ESteamNetworkingConnectionState_ClosedByPeer
){
433 if( info
->m_info
.m_eEndReason
==
434 k_ESteamNetConnectionEnd_Misc_InternalError
){
435 network_client
.retries
= 40;
437 network_disconnect();
439 else if( info
->m_info
.m_eState
==
440 k_ESteamNetworkingConnectionState_ProblemDetectedLocally
){
441 network_disconnect();
445 //vg_warn( " Recieved signal from unknown connection\n" );
448 render_server_status_gui();
451 static void on_persona_state_change( CallbackMsg_t
*msg
){
452 if( !network_connected() )
455 PersonaStateChange_t
*info
= (void *)msg
->m_pubParam
;
456 ISteamUser
*hSteamUser
= SteamAPI_SteamUser();
458 vg_info( "User: %llu, change: %u\n", info
->m_ulSteamID
,
459 info
->m_nChangeFlags
);
461 if( info
->m_ulSteamID
== SteamAPI_ISteamUser_GetSteamID(hSteamUser
) ){
462 if( info
->m_nChangeFlags
& k_EPersonaChangeName
){
463 network_send_username();
467 if( info
->m_nChangeFlags
& k_EPersonaChangeRelationshipChanged
){
468 for( u32 i
=0; i
<NETWORK_MAX_PLAYERS
; i
++ ){
469 struct network_player
*rp
= &netplayers
.list
[i
];
470 if( rp
->steamid
== info
->m_ulSteamID
){
471 player_remote_update_friendflags( rp
);
477 void network_set_host( const char *host_str
, const char *port_str
)
479 vg_strncpy( host_str
, network_client
.host_adress
,
480 sizeof(network_client
.host_adress
), k_strncpy_overflow_fatal
);
482 memset( &network_client
.ip
, 0, sizeof(network_client
.ip
) );
483 network_client
.ip_resolved
= 0;
487 vg_strncpy( port_str
, network_client
.host_port
,
488 sizeof(network_client
.host_port
), k_strncpy_overflow_fatal
);
493 vg_strnull( &str
, network_client
.host_port
,
494 sizeof(network_client
.host_port
) );
495 vg_strcati32( &str
, NETWORK_PORT
);
498 network_client
.ip
.m_port
= atoi( network_client
.host_port
);
501 static void network_connect(void)
503 VG_ASSERT( network_client
.ip_resolved
);
505 vg_info( "connecting...\n" );
506 network_client
.remote
= SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress(
507 hSteamNetworkingSockets
, &network_client
.ip
, 0, NULL
);
510 static void network_sign_on_complete(void){
511 vg_success( "Sign on completed\n" );
513 /* send our init info */
514 network_send_username();
515 for( u32 i
=0; i
<k_netmsg_playeritem_max
; i
++ ){
516 network_send_item(i
);
518 network_send_region();
521 static void poll_remote_connection(void){
522 SteamNetworkingMessage_t
*messages
[32];
525 for( int i
=0; i
<10; i
++ ){
526 len
= SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnConnection(
527 hSteamNetworkingSockets
, network_client
.remote
,
528 messages
, vg_list_size(messages
));
533 for( int i
=0; i
<len
; i
++ ){
534 SteamNetworkingMessage_t
*msg
= messages
[i
];
536 if( msg
->m_cbSize
< sizeof(netmsg_blank
) ){
537 vg_warn( "Discarding message (too small: %d)\n", msg
->m_cbSize
);
541 netmsg_blank
*tmp
= msg
->m_pData
;
543 if( (tmp
->inetmsg_id
>= 200) && (tmp
->inetmsg_id
< 300) ){
544 player_remote_rx_200_300( msg
);
546 else if( (tmp
->inetmsg_id
>= 300) && (tmp
->inetmsg_id
< 400) ){
547 network_request_rx_300_400( msg
);
550 if( tmp
->inetmsg_id
== k_inetmsg_version
){
551 netmsg_version
*version
= msg
->m_pData
;
552 if( version
->version
!= NETWORK_SKATERIFT_VERSION
){
553 network_disconnect();
554 /* we dont want to connect to this server ever */
555 network_client
.retries
= 999;
556 network_client
.last_attempt
= 999999999.9;
557 vg_error( "version mismatch with server\n" );
560 network_client
.remote_version
= version
->version
;
561 network_sign_on_complete();
566 SteamAPI_SteamNetworkingMessage_t_Release( msg
);
571 static void network_resolve_host_async( void *payload
, u32 size
)
573 u32
*status
= payload
;
574 network_client
.ip_resolved
= *status
;
577 SteamAPI_SteamNetworkingIPAddr_ToString( &network_client
.ip
, buf
, 256, 1 );
578 vg_info( "Resolved host address to: %s\n", buf
);
581 static void network_resolve_host_thread( void *_
)
583 vg_async_item
*call
= vg_async_alloc(8);
584 u32
*status
= call
->payload
;
587 if( (network_client
.host_adress
[0] >= '0') &&
588 (network_client
.host_adress
[0] <= '9') )
590 SteamAPI_SteamNetworkingIPAddr_ParseString(
592 network_client
.host_adress
);
593 network_client
.ip
.m_port
= atoi( network_client
.host_port
);
598 vg_info( "Resolving host.. %s (:%s)\n",
599 network_client
.host_adress
, network_client
.host_port
);
601 struct addrinfo hints
;
602 struct addrinfo
*result
;
604 /* Obtain address(es) matching host/port. */
606 memset( &hints
, 0, sizeof(hints
) );
607 hints
.ai_family
= AF_INET6
;
608 hints
.ai_socktype
= SOCK_DGRAM
;
609 hints
.ai_flags
= AI_V4MAPPED
| AI_ADDRCONFIG
;
610 hints
.ai_protocol
= 0;
612 int s
= getaddrinfo( network_client
.host_adress
, network_client
.host_port
,
616 vg_error( "getaddrinfo: %s\n", gai_strerror(s
) );
620 struct sockaddr_in6
*inaddr
= (struct sockaddr_in6
*)result
->ai_addr
;
621 memcpy( network_client
.ip
.m_ipv6
, &inaddr
->sin6_addr
, 16 );
622 freeaddrinfo( result
);
626 end
: vg_async_dispatch( call
, network_resolve_host_async
);
629 void network_update(void)
634 ESteamNetworkingConnectionState state
= network_client
.state
;
636 if( network_client
.user_intent
== k_server_intent_offline
)
638 if( state
!= k_ESteamNetworkingConnectionState_None
)
639 network_disconnect();
644 if( state
== k_ESteamNetworkingConnectionState_Connected
)
646 poll_remote_connection();
647 f64 frame_delta
= vg
.time_real
- network_client
.last_frame
;
649 if( frame_delta
> NETWORK_FRAMERATE
)
651 network_client
.last_frame
= vg
.time_real
;
652 remote_player_send_playerframe();
653 localplayer
.sfx_buffer_count
= 0;
656 remote_player_debug_update();
660 if( (state
== k_ESteamNetworkingConnectionState_Connecting
) ||
661 (state
== k_ESteamNetworkingConnectionState_FindingRoute
) )
667 f64 waited
= vg
.time_real
- network_client
.last_attempt
,
670 if( network_client
.retries
> 5 )
673 if( waited
< min_wait
)
676 if( !network_client
.ip_resolved
)
678 if( vg_loader_availible() )
680 vg_loader_start( network_resolve_host_thread
, NULL
);
687 network_client
.retries
++;
688 network_client
.last_attempt
= vg
.time_real
;
693 void chat_send_message( const char *message
)
695 if( !network_connected() ){
699 netmsg_chat
*chat
= alloca( sizeof(netmsg_chat
) + NETWORK_MAX_CHAT
);
700 chat
->inetmsg_id
= k_inetmsg_chat
;
703 u32 l
= vg_strncpy( message
, chat
->msg
, NETWORK_MAX_CHAT
,
704 k_strncpy_always_add_null
);
706 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(
707 hSteamNetworkingSockets
, network_client
.remote
,
708 chat
, sizeof(netmsg_chat
)+l
+1,
709 k_nSteamNetworkingSend_Reliable
, NULL
);
712 static int cmd_network_send_message( int argc
, const char *argv
[] ){
713 char buf
[ NETWORK_MAX_CHAT
];
715 vg_strnull( &str
, buf
, NETWORK_MAX_CHAT
);
717 for( int i
=0; i
<argc
; i
++ ){
718 vg_strcat( &str
, argv
[i
] );
721 vg_strcatch( &str
, ' ' );
724 chat_send_message( buf
);
728 void network_init(void)
730 vg_console_reg_var( "network_info", &network_client
.network_info
,
731 k_var_dtype_i32
, VG_VAR_PERSISTENT
);
732 vg_console_reg_var( "auto_connect", &network_client
.auto_connect
,
733 k_var_dtype_i32
, VG_VAR_PERSISTENT
);
735 u32 alloc_size
= sizeof(struct network_request
)*NETWORK_MAX_REQUESTS
;
736 network_client
.request_buffer
=
737 vg_linear_alloc( vg_mem
.rtmemory
, alloc_size
);
738 memset( network_client
.request_buffer
, 0, alloc_size
);
740 vg_pool
*pool
= &network_client
.request_pool
;
741 pool
->buffer
= network_client
.request_buffer
;
742 pool
->count
= NETWORK_MAX_REQUESTS
;
743 pool
->stride
= sizeof( struct network_request
);
744 pool
->offset
= offsetof( struct network_request
, poolnode
);
745 vg_pool_init( pool
);
747 steam_register_callback( k_iSteamNetConnectionStatusChangedCallBack
,
748 on_server_connect_status
);
749 steam_register_callback( k_iPersonaStateChange
,
750 on_persona_state_change
);
751 request_auth_ticket();
753 vg_console_reg_cmd( "say", cmd_network_send_message
, NULL
);
757 void network_end(void)
759 /* TODO: Send buffered highscores that were not already */
760 if( (network_client
.state
== k_ESteamNetworkingConnectionState_Connected
) ||
761 (network_client
.state
== k_ESteamNetworkingConnectionState_Connecting
) )
763 SteamAPI_ISteamNetworkingSockets_CloseConnection(
764 hSteamNetworkingSockets
, network_client
.remote
, 0, NULL
, 1 );