Core/Network: Simplify worldserver port configuration: removed InstanceServerPort

Port From (https://github.com/TrinityCore/TrinityCore/commit/039acb20e4c218757d6b9fc441dc2da6820dafd1)
This commit is contained in:
Hondacrx
2025-06-02 15:48:10 -04:00
parent 34edc91ec5
commit de0c4f2fe5
6 changed files with 3 additions and 29 deletions
@@ -1729,7 +1729,6 @@ namespace Framework.Constants
PdumpNoPaths,
PersistentCharacterCleanFlags,
PlayerAllowCommands,
PortInstance,
PortWorld,
PreserveCustomChannelDuration,
PreserveCustomChannelInterval,
+2 -1
View File
@@ -57,7 +57,6 @@ namespace Game.Networking
public WorldSocket(Socket socket) : base(socket)
{
_connectType = ConnectionType.Realm;
_serverChallenge = Array.Empty<byte>().GenerateRandomKey(32);
_worldCrypt = new WorldCrypt();
_encryptKey = new byte[32];
@@ -448,6 +447,8 @@ namespace Game.Networking
void HandleSendAuthSession()
{
_serverChallenge = Array.Empty<byte>().GenerateRandomKey(32);
AuthChallenge challenge = new();
challenge.Challenge = _serverChallenge;
challenge.DosChallenge = new byte[32].GenerateRandomKey(32);
@@ -24,25 +24,14 @@ namespace Game.Networking
if (!base.StartNetwork(bindIp, port, threadCount))
return false;
_instanceAcceptor = new AsyncAcceptor();
if (!_instanceAcceptor.Start(bindIp, WorldConfig.GetIntValue(WorldCfg.PortInstance)))
{
Log.outError(LogFilter.Network, "StartNetwork failed to start instance AsyncAcceptor");
return false;
}
Acceptor.AsyncAcceptSocket(OnSocketAccept);
_instanceAcceptor.AsyncAcceptSocket(OnSocketOpen);
return true;
}
public override void StopNetwork()
{
_instanceAcceptor.Close();
base.StopNetwork();
_instanceAcceptor = null;
}
public override void OnSocketOpen(Socket sock)
@@ -70,7 +59,6 @@ namespace Game.Networking
Global.WorldSocketMgr.OnSocketOpen(sock);
}
AsyncAcceptor _instanceAcceptor;
int _socketSendBufferSize;
bool _tcpNoDelay;
}
-7
View File
@@ -259,16 +259,9 @@ namespace Game
int val = GetDefaultValue("WorldServerPort", 8085);
if (val != (int)Values[WorldCfg.PortWorld])
Log.outError(LogFilter.ServerLoading, "WorldServerPort option can't be changed at worldserver.conf reload, using current value ({0}).", Values[WorldCfg.PortWorld]);
val = GetDefaultValue("InstanceServerPort", 8086);
if (val != (int)Values[WorldCfg.PortInstance])
Log.outError(LogFilter.ServerLoading, "InstanceServerPort option can't be changed at worldserver.conf reload, using current value ({0}).", Values[WorldCfg.PortInstance]);
}
else
{
Values[WorldCfg.PortWorld] = GetDefaultValue("WorldServerPort", 8085);
Values[WorldCfg.PortInstance] = GetDefaultValue("InstanceServerPort", 8086);
}
// Config values are in "milliseconds" but we handle SocketTimeOut only as "seconds" so divide by 1000
Values[WorldCfg.SocketTimeoutTime] = GetDefaultValue("SocketTimeOutTime", 900000) / 1000;
+1 -1
View File
@@ -492,7 +492,7 @@ namespace Game
ConnectTo connectTo = new();
connectTo.Key = _instanceConnectKey.Raw;
connectTo.Serial = serial;
connectTo.Payload.Port = (ushort)WorldConfig.GetIntValue(WorldCfg.PortInstance);
connectTo.Payload.Port = (ushort)WorldConfig.GetIntValue(WorldCfg.PortWorld);
connectTo.Con = (byte)ConnectionType.Instance;
if (instanceAddress != null)
-7
View File
@@ -81,13 +81,6 @@ HotfixDatabaseInfo.SSL = false
WorldServerPort = 8085
#
# InstanceServerPort
# Description: TCP port to for second world connection.
# Default: 8086
InstanceServerPort = 8086
#
# BindIP
# Description: Bind world server to IP/hostname.