X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=server.c;h=e3149c9caa371513ea1a64e95a39389cb1c7a8dd;hb=4af3f141e332ae426ecda80ca4ccd8cf4e84d0cb;hp=4f3ceb6b27dd7023c9473414a1d0019197741109;hpb=4744d53642cca117c2e130d39cc58b2911336bf3;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/server.c b/server.c index 4f3ceb6..e3149c9 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,6 @@ -/* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */ +/* + * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved + */ /* * This server application requires steamclient.so to be present in the @@ -9,6 +11,7 @@ #define _DEFAULT_SOURCE #include #include +#include volatile sig_atomic_t sig_stop; @@ -34,6 +37,7 @@ static void *hSteamHTTP, static u8 steam_symetric_key[ k_nSteamEncryptedAppTicketSymmetricKeyLen ]; static HSteamNetPollGroup client_pollgroup; +#if 0 static void recieve_http( void *callresult, void *context ) { HTTPRequestCompleted_t *result = callresult; @@ -43,16 +47,17 @@ static void recieve_http( void *callresult, void *context ) SteamAPI_ISteamHTTP_GetHTTPResponseBodySize( hSteamHTTP, request, &size ); - u8 *buffer = malloc( size ); + u8 *buffer = vg_alloc( size ); SteamAPI_ISteamHTTP_GetHTTPResponseBodyData( hSteamHTTP, request, buffer, size ); buffer[size-1] = '\0'; vg_info( "%s\n", (char *)buffer ); - free( buffer ); + vg_free( buffer ); SteamAPI_ISteamHTTP_ReleaseHTTPRequest( hSteamHTTP, result->m_hRequest ); } +#endif static u64_steamid get_connection_authsteamid( SteamNetworkingMessage_t *msg ) { @@ -123,7 +128,7 @@ static void on_inet_auth( SteamNetworkingMessage_t *msg ) return; } - vg_log( "Attempting to verify user\n" ); + vg_low( "Attempting to verify user\n" ); if( msg->m_cbSize < sizeof(netmsg_auth) ) { @@ -330,8 +335,16 @@ int main( int argc, char *argv[] ) { signal( SIGINT, inthandler ); signal( SIGQUIT, inthandler ); + + /* TODO: Options to override, ammend, remove etc */ + + vg_set_mem_quota( 80*1024*1024 ); + vg_alloc_quota(); highscores_init( 250000, 10000 ); + + if( !highscores_read() ) + highscores_create_db(); steamworks_ensure_txt( "2103940" ); if( !vg_load_steam_symetric_key( "application_key", steam_symetric_key ) ) @@ -418,7 +431,6 @@ int main( int argc, char *argv[] ) } highscores_serialize_all(); - highscores_free(); SteamAPI_ISteamNetworkingSockets_DestroyPollGroup( hSteamNetworkingSockets, client_pollgroup );