Login flow tuning: packet format, diagnostics, and compose defaults
This commit is contained in:
parent
f439be2386
commit
7f4473e52d
5 changed files with 39 additions and 13 deletions
|
|
@ -118,7 +118,11 @@ services:
|
|||
environment:
|
||||
SERVER_PORT: 4000
|
||||
DEV_LOGIN_BYPASS: "true"
|
||||
LOGIN_PACKET_TRACE: "true"
|
||||
LOGIN_PACKET_TRACE: "false"
|
||||
LOGIN_CHANNEL_OLD_FORMAT: "true"
|
||||
LOGIN_CHANNEL_MINIMAL: "false"
|
||||
LOGIN_CHANNEL_SEND_BOTH: "false"
|
||||
LOGIN_PLAINTEXT_SEND: "false"
|
||||
MASTER_IP: master
|
||||
MASTER_PORT: 20500
|
||||
DB_SERVER_IP: database
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
//
|
||||
// Developed by NosWings Team
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using LoginServer.Network;
|
||||
using PhoenixLib.Logging;
|
||||
|
|
@ -22,12 +24,9 @@ namespace LoginServer.Handlers
|
|||
string lastGroup = string.Empty;
|
||||
int worldGroupCount = 0;
|
||||
var packetBuilder = new StringBuilder();
|
||||
packetBuilder.AppendFormat($"NsTeST {(byte)region} {sessionId} 2 ");
|
||||
|
||||
packetBuilder.Append(
|
||||
isOldLogin
|
||||
? $"-99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 {encryptionKey} "
|
||||
: $"-99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 -99 0 {encryptionKey} ");
|
||||
string serverlist = string.Join(" ", Enumerable.Range(0, 60).Select(_ => "-99 0"));
|
||||
packetBuilder.AppendFormat($"NsTeST {(byte)region} {sessionId} {serverlist} {encryptionKey} ");
|
||||
|
||||
foreach (SerializableGameServer world in worldServers)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -149,8 +149,7 @@ namespace LoginServer.Handlers
|
|||
break;
|
||||
|
||||
default:
|
||||
// Temporary: do not block logins by maintenance flag while local setup is being validated.
|
||||
if (false && _maintenanceManager.IsMaintenanceActive && loadedAccount.Authority < AuthorityType.GameMaster)
|
||||
if (_maintenanceManager.IsMaintenanceActive && loadedAccount.Authority < AuthorityType.GameMaster)
|
||||
{
|
||||
session.SendPacket(session.GenerateFailcPacket(LoginFailType.Maintenance));
|
||||
return;
|
||||
|
|
@ -187,7 +186,14 @@ namespace LoginServer.Handlers
|
|||
return;
|
||||
}
|
||||
|
||||
session.SendChannelPacketList(connectedSession.EncryptionKey, loadedAccount.Name, RegionLanguageType.EN, worldServersResponse.WorldServers, true);
|
||||
bool oldFormat = !string.Equals(Environment.GetEnvironmentVariable("LOGIN_CHANNEL_OLD_FORMAT"), "false", StringComparison.OrdinalIgnoreCase);
|
||||
session.SendChannelPacketList(connectedSession.EncryptionKey, loadedAccount.Name, RegionLanguageType.EN, worldServersResponse.WorldServers, oldFormat);
|
||||
|
||||
bool sendBoth = string.Equals(Environment.GetEnvironmentVariable("LOGIN_CHANNEL_SEND_BOTH"), "true", StringComparison.OrdinalIgnoreCase);
|
||||
if (sendBoth)
|
||||
{
|
||||
session.SendChannelPacketList(connectedSession.EncryptionKey, loadedAccount.Name, RegionLanguageType.EN, worldServersResponse.WorldServers, !oldFormat);
|
||||
}
|
||||
session.Disconnect();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@ namespace LoginServer.Handlers
|
|||
break;
|
||||
|
||||
default:
|
||||
// Temporary: do not block logins by maintenance flag while local setup is being validated.
|
||||
if (false && _maintenanceManager.IsMaintenanceActive && loadedAccount.Authority < AuthorityType.GameMaster)
|
||||
if (_maintenanceManager.IsMaintenanceActive && loadedAccount.Authority < AuthorityType.GameMaster)
|
||||
{
|
||||
session.SendPacket(session.GenerateFailcPacket(LoginFailType.Maintenance));
|
||||
return;
|
||||
|
|
@ -178,7 +177,14 @@ namespace LoginServer.Handlers
|
|||
return;
|
||||
}
|
||||
|
||||
session.SendChannelPacketList(connectedSession.EncryptionKey, loadedAccount.Name, RegionLanguageType.EN, worldServersResponse.WorldServers, true);
|
||||
bool oldFormat = !string.Equals(Environment.GetEnvironmentVariable("LOGIN_CHANNEL_OLD_FORMAT"), "false", StringComparison.OrdinalIgnoreCase);
|
||||
session.SendChannelPacketList(connectedSession.EncryptionKey, loadedAccount.Name, RegionLanguageType.EN, worldServersResponse.WorldServers, oldFormat);
|
||||
|
||||
bool sendBoth = string.Equals(Environment.GetEnvironmentVariable("LOGIN_CHANNEL_SEND_BOTH"), "true", StringComparison.OrdinalIgnoreCase);
|
||||
if (sendBoth)
|
||||
{
|
||||
session.SendChannelPacketList(connectedSession.EncryptionKey, loadedAccount.Name, RegionLanguageType.EN, worldServersResponse.WorldServers, !oldFormat);
|
||||
}
|
||||
session.Disconnect();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,18 @@ namespace LoginServer.Network
|
|||
|
||||
public string IpAddress { get; private set; }
|
||||
|
||||
public void SendPacket(string packet) => Send(NostaleLoginEncrypter.Encode(packet, Encoding.Default).ToArray());
|
||||
public void SendPacket(string packet)
|
||||
{
|
||||
bool plainSend = string.Equals(Environment.GetEnvironmentVariable("LOGIN_PLAINTEXT_SEND"), "true", StringComparison.OrdinalIgnoreCase);
|
||||
if (plainSend)
|
||||
{
|
||||
// Debug compatibility mode: send plain text packet with LF terminator.
|
||||
Send(Encoding.Default.GetBytes(packet + "\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
Send(NostaleLoginEncrypter.Encode(packet, Encoding.Default).ToArray());
|
||||
}
|
||||
|
||||
protected override void OnConnected()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue