Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions common/proto_oob.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// This is used, unless overridden in the registry
#define VALVE_MASTER_ADDRESS "207.173.177.10:27011"

#define HB_TIMEOUT 15

#define PORT_RCON 27015 // defualt RCON port, TCP
#define PORT_MASTER 27011 // Default master port, UDP
#define PORT_CLIENT 27005 // Default client port, UDP/TCP
Expand All @@ -29,6 +31,8 @@
#endif // ENABLE_RPT
#define PORT_REPLAY 27040 // Default replay port

#define PORT_SERVERSINFO 27069 // Default matchmaking port

// out of band message id bytes

// M = master, S = server, C = client, A = any
Expand Down Expand Up @@ -80,16 +84,17 @@


// A user is requesting the list of master servers, auth servers, and titan dir servers from the Client Master server
#define A2M_GETMASTERSERVERS 'v' // + byte (type of request, TYPE_CLIENT_MASTER or TYPE_SERVER_MASTER)

// Master server list response
#define M2A_MASTERSERVERS 'w' // + byte type + 6 byte IP/Port List

#define A2M_GETACTIVEMODS 'x' // + string Request to master to provide mod statistics ( current usage ). "1" for first mod.
#define S2M_GETCHALLENGE 'w' // + dword challenge
#define S2M_HEARTBEAT 'y'
#define S2M_SHUTDOWN 'z' // Master peering message
#define M2S_CHALLENGE 'x' // + dword challenge
#define M2C_QUERY 'J' // request module from master
#define C2M_CLIENTQUERY '1' // New style server query

#define M2A_ACTIVEMODS 'y' // response: modname\r\nusers\r\nservers

#define M2M_MSG 'z' // Master peering message
#define C2S_INFOREQUEST 'v'
#define S2C_INFOREPLY 'K'

// SERVER TO CLIENT/ANY

Expand All @@ -106,9 +111,6 @@
#define S2A_INFO_SRC 'I' // + Address, hostname, map, gamedir, gamedescription, active players, maxplayers, protocol
#define S2A_INFO_GOLDSRC 'm' // Reserved for use by goldsrc servers

#define S2M_GETFILE 'J' // request module from master
#define M2S_SENDFILE 'K' // send module to server

#define S2C_REDIRECT 'L' // + IP x.x.x.x:port, redirect client to other server/proxy

#define C2M_CHECKMD5 'M' // player client asks secure master if Module MD5 is valid
Expand All @@ -133,8 +135,6 @@

#define A2S_KEY_STRING "Source Engine Query" // required postfix to a A2S_INFO query

#define A2M_GET_SERVERS_BATCH2 '1' // New style server query

#define A2M_GETACTIVEMODS2 '2' // New style mod info query

#define C2S_AUTHREQUEST1 '3' //
Expand Down
2 changes: 1 addition & 1 deletion engine/baseclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@ void CBaseClient::UpdateUserSettings()
SetRate( rate, false );

// set server to client update rate
SetUpdateRate( m_ConVars->GetInt( "cl_updaterate", 20), false );
SetUpdateRate( m_ConVars->GetInt( "cl_updaterate", 60), false );

SetMaxRoutablePayloadSize( m_ConVars->GetInt( "net_maxroutable", MAX_ROUTABLE_PAYLOAD ) );

Expand Down
3 changes: 3 additions & 0 deletions engine/baseclientstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "sv_plugin.h"
#include "sys_dll.h"
#include "host.h"
#include "master.h"
#if defined( REPLAY_ENABLED )
#include "replay_internal.h"
#include "replayserver.h"
Expand Down Expand Up @@ -875,6 +876,8 @@ bool CBaseClientState::ProcessConnectionlessPacket( netpacket_t *packet )

Assert( packet );

master->ProcessConnectionlessPacket( packet );

bf_read &msg = packet->message; // handy shortcut

int c = msg.ReadByte();
Expand Down
3 changes: 3 additions & 0 deletions engine/baseserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "sv_ipratelimit.h"
#include "cl_steamauth.h"
#include "sv_filter.h"
#include "master.h"

#if defined( _X360 )
#include "xbox/xbox_win32stubs.h"
Expand Down Expand Up @@ -663,6 +664,8 @@ bool CBaseServer::ValidInfoChallenge( netadr_t & adr, const char *nugget )

bool CBaseServer::ProcessConnectionlessPacket(netpacket_t * packet)
{
master->ProcessConnectionlessPacket( packet );

bf_read msg = packet->message; // handy shortcut

char c = msg.ReadChar();
Expand Down
5 changes: 4 additions & 1 deletion engine/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "steam/steam_api.h"
#include "LoadScreenUpdate.h"
#include "datacache/idatacache.h"
#include "master.h"

#if !defined SWDS
#include "voice.h"
Expand Down Expand Up @@ -1820,6 +1821,8 @@ void Host_ShutdownServer( void )
if ( !sv.IsActive() )
return;

master->ShutdownConnection();

Host_AllowQueuedMaterialSystem( false );
// clear structures
#if !defined( SWDS )
Expand Down Expand Up @@ -4951,7 +4954,7 @@ void Host_Shutdown(void)
TRACESHUTDOWN( HLTV_Shutdown() );

TRACESHUTDOWN( g_Log.Shutdown() );

TRACESHUTDOWN( g_GameEventManager.Shutdown() );

TRACESHUTDOWN( sv.Shutdown() );
Expand Down
61 changes: 61 additions & 0 deletions engine/master.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//======== (C) Copyright 1999, 2000 Valve, L.L.C. All rights reserved. ========
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
// Valve, L.L.C., or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================
#ifndef MASTER_H
#define MASTER_H
#ifdef _WIN32
#pragma once
#endif

#include "engine/iserversinfo.h"

//-----------------------------------------------------------------------------
// Purpose: Implements a master server interface.
//-----------------------------------------------------------------------------
class IMaster
{
public:
// Allow master server to register cvars/commands
virtual void Init( void ) = 0;
// System is shutting down
virtual void Shutdown( void ) = 0;
// Server is shutting down
virtual void ShutdownConnection( void ) = 0;
// Sends the actual heartbeat to the master ( after challenge value is parsed )
virtual void SendHeartbeat( struct adrlist_s *p ) = 0;
// Add server to global master list
virtual void AddServer( struct netadr_s *adr ) = 0;
// If parsing for server, etc. fails, always have at least one server around to use.
virtual void UseDefault ( void ) = 0;
// See if it's time to send the next heartbeat
virtual void CheckHeartbeat( void ) = 0;
// Master sent back a challenge value, read it and send the actual heartbeat
virtual void RespondToHeartbeatChallenge( netadr_t &from, bf_read &msg ) = 0;
// Console command to set/remove master server
virtual void AddMaster_f( const CCommand &args ) = 0;
// Force a heartbeat to be issued right away
virtual void Heartbeat_f( void ) = 0;

virtual void ProcessConnectionlessPacket( netpacket_t *packet ) = 0;

virtual void RunFrame( void ) = 0;
};

extern IMaster *master;
extern IServersInfo *g_pServersInfo;

#endif // MASTER_H
Loading