Allow users to actually connect lol

This commit is contained in:
Bluzume 2021-11-25 17:18:53 -05:00
parent 6734154867
commit e75a8aa51c
3 changed files with 29 additions and 28 deletions

View file

@ -412,20 +412,23 @@ namespace HISP.Server
*/ */
try try
{ {
if (timeoutTimer != null) if (LoggedIn)
timeoutTimer.Change(timeoutInterval, timeoutInterval); // Reset time before timing out {
else if (timeoutTimer != null)
return; timeoutTimer.Change(timeoutInterval, timeoutInterval); // Reset time before timing out
else
return;
if (keepAliveTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE) if (keepAliveTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE)
{ {
if (LoggedIn) if (LoggedIn)
LoggedinUser.Idle = false; LoggedinUser.Idle = false;
keepAliveTimer.Change(oneMinute, oneMinute); keepAliveTimer.Change(oneMinute, oneMinute);
} }
else else
{ {
return; return;
}
} }
if (kickTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE) if (kickTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE)
@ -437,7 +440,6 @@ namespace HISP.Server
warnTimer.Change(warnInterval, warnInterval); warnTimer.Change(warnInterval, warnInterval);
else else
return; return;
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
@ -454,12 +456,11 @@ namespace HISP.Server
{ {
if (!LoggedIn) // Must be either login or policy-file-request if (!LoggedIn) // Must be either login or policy-file-request
{ {
if (Encoding.UTF8.GetString(Packet).StartsWith("<policy-file-request/>")) // Policy File Request
{
GameServer.OnCrossdomainPolicyRequest(this);
}
switch (identifier) switch (identifier)
{ {
case PacketBuilder.PACKET_FLASH_XML_CROSSDOMAIN:
GameServer.OnCrossdomainPolicyRequest(this, Packet);
break;
case PacketBuilder.PACKET_LOGIN: case PacketBuilder.PACKET_LOGIN:
GameServer.OnLoginRequest(this, Packet); GameServer.OnLoginRequest(this, Packet);
break; break;
@ -547,10 +548,7 @@ namespace HISP.Server
} }
catch(Exception e) catch(Exception e)
{ {
Logger.ErrorPrint("Unhandled Exception: " + e.ToString()); Logger.ErrorPrint("Unhandled Exception: " + e.ToString() + "\n" + e.Message + "\n" + e.StackTrace);
Logger.ErrorPrint(e.Message);
Logger.ErrorPrint("");
Logger.ErrorPrint(e.StackTrace);
Kick("Unhandled Exception: " + e.ToString()); Kick("Unhandled Exception: " + e.ToString());
} }

View file

@ -259,13 +259,15 @@ namespace HISP.Server
*/ */
public static void OnCrossdomainPolicyRequest(GameClient sender) public static void OnCrossdomainPolicyRequest(GameClient sender, byte[] packet)
{ {
Logger.DebugPrint("Cross-Domain-Policy request received from: " + sender.RemoteIp); if (Encoding.UTF8.GetString(packet).StartsWith("<policy-file-request/>"))
{
Logger.DebugPrint("Cross-Domain-Policy request received from: " + sender.RemoteIp);
byte[] crossDomainPolicyResponse = CrossDomainPolicy.GetPolicy();
sender.SendPacket(crossDomainPolicyResponse);
byte[] crossDomainPolicyResponse = CrossDomainPolicy.GetPolicy(); }
sender.SendPacket(crossDomainPolicyResponse);
} }
public static void OnPlayerInteration(GameClient sender, byte[] packet) public static void OnPlayerInteration(GameClient sender, byte[] packet)

View file

@ -13,7 +13,8 @@ namespace HISP.Server
public const byte PACKET_TERMINATOR = 0x00; public const byte PACKET_TERMINATOR = 0x00;
public const byte PACKET_CLIENT_TERMINATOR = 0x0A; public const byte PACKET_CLIENT_TERMINATOR = 0x0A;
public const byte PACKET_FLASH_XML_CROSSDOMAIN = 0x3C;
public const byte PACKET_LOGIN = 0x7F; public const byte PACKET_LOGIN = 0x7F;
public const byte PACKET_CHAT = 0x14; public const byte PACKET_CHAT = 0x14;