Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #include "server_pch.h"
  10. #include "server.h"
  11. #include "master.h"
  12. #include "proto_oob.h"
  13. #include "sv_main.h" // SV_GetFakeClientCount()
  14. #include "tier0/icommandline.h"
  15. #include "FindSteamServers.h"
  16. #include "filesystem_engine.h"
  17. #include "sv_steamauth.h"
  18. #include "hltvserver.h"
  19. // memdbgon must be the last include file in a .cpp file!!!
  20. #include "tier0/memdbgon.h"
  21. bool g_bEnableMasterServerUpdater = true;
  22. static void SvSearchKeyChangeCallback( IConVar *pConVar, const char *pOldValue, float flOldValue )
  23. {
  24. sv.UpdateGameData();
  25. if ( sv.IsActive() )
  26. {
  27. Cbuf_AddText( CBUF_SERVER, "heartbeat\n" );
  28. }
  29. }
  30. ConVar sv_search_key( "sv_search_key",
  31. #if defined( _PS3 )
  32. "csgo-ps3-rc0",
  33. #elif defined( SERVER_XLSP ) || defined( _X360 )
  34. "csgo-x360-rc1",
  35. #else
  36. "",
  37. #endif
  38. FCVAR_RELEASE, "When searching for a dedicated server from lobby, restrict search to only dedicated servers having the same sv_search_key.", SvSearchKeyChangeCallback );
  39. //-----------------------------------------------------------------------------
  40. // Purpose:
  41. //-----------------------------------------------------------------------------
  42. void Heartbeat_f()
  43. {
  44. if ( g_nForkID != FORK_ID_PARENT_PROCESS ) // if we are the process parent, we won't advertise ourself to steam / xlsp
  45. {
  46. if( Steam3Server().SteamGameServer() )
  47. {
  48. Steam3Server().SteamGameServer()->ForceHeartbeat();
  49. }
  50. }
  51. }
  52. static ConCommand heartbeat( "heartbeat", Heartbeat_f, "Force heartbeat of master servers", 0 );