Core/PacketIO: implement a legacy connection mode which uses only the first connection socket to allow older pre-patched clients to connect

This commit is contained in:
Ovahlord committed 2025-06-21 15:32:25 +02:00
1 parent 4b7d68830a
commit 94bdf7c094
7 files changed
+33 -7

No files matched your search

@@ -752,7 +752,10 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPackets::Character::PlayerLogin&
return;
}
SendConnectToInstance(WorldPackets::Auth::ConnectToSerial::WorldAttempt1);
if (_legacyConnectionModeEnabled)
HandleContinuePlayerLogin();
else
SendConnectToInstance(WorldPackets::Auth::ConnectToSerial::WorldAttempt1);
}
void WorldSession::HandleContinuePlayerLogin()
@@ -770,7 +773,8 @@ void WorldSession::HandleContinuePlayerLogin()
return;
}
SendPacket(WorldPackets::Auth::ResumeComms(CONNECTION_TYPE_INSTANCE).Write());
if (!_legacyConnectionModeEnabled)
SendPacket(WorldPackets::Auth::ResumeComms(CONNECTION_TYPE_INSTANCE).Write());
AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(holder)).AfterComplete([this](SQLQueryHolderBase const& holder)
{
+11 -4
View File
@@ -16,13 +16,16 @@
*/
#include "Opcodes.h"
#include "Log.h"
#include "WorldSession.h"
#include "Packets/AllPackets.h"
#include <iomanip>
#include <sstream>
template<class PacketClass, void(WorldSession::*HandlerFunction)(PacketClass&)>
#include "Log.h"
#include "Packets/AllPackets.h"
#include "World.h"
#include "WorldSession.h"
template <class PacketClass, void(WorldSession::*HandlerFunction)(PacketClass&)>
class PacketHandler : public ClientOpcodeHandler
{
public:
@@ -128,6 +131,10 @@ void OpcodeTable::ValidateAndSetServerOpcode(OpcodeServer opcode, char const* na
return;
}
// If the legacy connection mode has been enabled, all packets will get sent on one connection
if (sWorld->getBoolConfig(CONFIG_LEGACY_CONNECTION_MODE))
conIdx = CONNECTION_TYPE_REALM;
if (_internalTableServer[opcode] != nullptr)
{
TC_LOG_ERROR("network", "Tried to override server handler of %s with %s (opcode %u)", opcodeTable[opcode]->Name, name, opcode);
+2 -1
View File
@@ -140,7 +140,8 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
_timeSyncClockDeltaQueue(std::make_unique<boost::circular_buffer<std::pair<int64, uint32>>>(6)),
_timeSyncClockDelta(0),
_pendingTimeSyncRequests(),
_gameClient(new GameClient(this))
_gameClient(new GameClient(this)),
_legacyConnectionModeEnabled(sWorld->getBoolConfig(CONFIG_LEGACY_CONNECTION_MODE))
{
memset(m_Tutorials, 0, sizeof(m_Tutorials));
+1
View File
@@ -1420,6 +1420,7 @@ class TC_GAME_API WorldSession
ConnectToKey _instanceConnectKey;
GameClient* _gameClient;
bool _legacyConnectionModeEnabled;
WorldSession(WorldSession const& right) = delete;
WorldSession& operator=(WorldSession const& right) = delete;
+3
View File
@@ -1644,6 +1644,9 @@ void World::LoadConfigSettings(bool reload)
// Anti movement cheat measure. Time each client have to acknowledge a movement change until they are kicked
m_int_configs[CONFIG_PENDING_MOVE_CHANGES_TIMEOUT] = sConfigMgr->GetIntDefault("AntiCheat.PendingMoveChangesTimeoutTime", 0);
// Legacy connection mode
m_bool_configs[CONFIG_LEGACY_CONNECTION_MODE] = sConfigMgr->GetBoolDefault("LegacyConnectionModeEnabled", false);
// call ScriptMgr if we're reloading the configuration
if (reload)
sScriptMgr->OnConfigLoad(reload);
+1
View File
@@ -186,6 +186,7 @@ enum WorldBoolConfigs : uint8
CONFIG_CHECK_GOBJECT_LOS,
CONFIG_RESPAWN_DYNAMIC_ESCORTNPC,
CONFIG_CACHE_DATA_QUERIES,
CONFIG_LEGACY_CONNECTION_MODE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -266,6 +266,15 @@ ProcessPriority = 0
Compression = 1
#
# LegacyConnectionModeEnabled
# Description: Enables/Disables the legacy connection handling in which only one connection socket
# is being used to send and receive packets. This allows older pre-patched clients to connect.
# Default: 0 - (Disabled, Both sockets are used and required)
# 1 - (Enabled, One the first socket is being used)
LegacyConnectionModeEnabled = 0
#
# PlayerLimit
# Description: Maximum number of players in the world. Excluding Mods, GMs and Admins.