![]() |
Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
#include "precompiled.h"#include "NetServer.h"#include "lib/code_generation.h"#include "lib/debug.h"#include "lib/external_libraries/enet.h"#include "lib/secure_crt.h"#include "lib/status.h"#include "lib/utf8.h"#include "network/FSM.h"#include "network/NetEnet.h"#include "network/NetFileTransfer.h"#include "network/NetHost.h"#include "network/NetMessage.h"#include "network/NetProtocol.h"#include "network/NetServerTurnManager.h"#include "network/NetServerSession.h"#include "network/NetStats.h"#include "network/StunClient.h"#include "ps/CLogger.h"#include "ps/ConfigDB.h"#include "ps/GUID.h"#include "ps/Hashing.h"#include "ps/ProfileViewer.h"#include "ps/Profiler2.h"#include "ps/Threading.h"#include "ps/algorithm.h"#include "scriptinterface/JSON.h"#include "scriptinterface/Object.h"#include "scriptinterface/Context.h"#include "scriptinterface/Interface.h"#include "scriptinterface/Request.h"#include "simulation2/helpers/SimulationCommand.h"#include "simulation2/system/TurnManager.h"#include <algorithm>#include <cstring>#include <fmt/format.h>#include <functional>#include <iterator>#include <memory>#include <set>#include <sstream>#include <string>#include <utility>#include <miniupnpc/igd_desc_parse.h>#include <miniupnpc/miniupnpc.h>#include <miniupnpc/upnpcommands.h>#include <miniupnpc/upnpdev.h>#include <miniupnpc/upnperrors.h>
Macros | |
| #define | MAX_CLIENTS 41 |
| Number of peers to allocate for the enet host. More... | |
Functions | |
| static CStr | DebugName (CNetServerSession *session) |
Variables | |
| constexpr int | CHANNEL_COUNT = 1 |
| constexpr int | FAILED_PASSWORD_TRIES_BEFORE_BAN = 3 |
| static const int | HOST_SERVICE_TIMEOUT = 50 |
| enet_host_service timeout (msecs). More... | |
| constexpr std::uint32_t | NETWORK_BAD_PING = DEFAULT_TURN_LENGTH * COMMAND_DELAY_MP / 2 |
| Once ping goes above turn length * command delay, the game will start 'freezing' for other clients while we catch up. More... | |
| constexpr std::int32_t | MAX_COMMAND_TURN_FACTOR = 5 |
| Legitimate clients only send commands for turns up to about ready turn + COMMAND_DELAY_MP. More... | |
| CNetServer * | g_NetServer = NULL |
| Global network server for the standard game. More... | |
| #define MAX_CLIENTS 41 |
Number of peers to allocate for the enet host.
Limited by ENET_PROTOCOL_MAXIMUM_PEER_ID (4096).
At most 8 players, 32 observers and 1 temporary connection to send the "server full" disconnect-reason.
|
static |
|
constexpr |
|
constexpr |
| CNetServer* g_NetServer = NULL |
Global network server for the standard game.
|
static |
enet_host_service timeout (msecs).
Smaller numbers may hurt performance; larger numbers will hurt latency responding to messages from game thread.
|
constexpr |
Legitimate clients only send commands for turns up to about ready turn + COMMAND_DELAY_MP.
Commands further ahead than MAX_COMMAND_TURN_FACTOR * COMMAND_DELAY_MP are treated as an attack.
|
constexpr |
Once ping goes above turn length * command delay, the game will start 'freezing' for other clients while we catch up.
Since commands are sent client -> server -> client, divide by 2. (duplicated in NetServer.cpp to avoid having to fetch the constants in a header file)