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
{
if (timeoutTimer != null)
timeoutTimer.Change(timeoutInterval, timeoutInterval); // Reset time before timing out
else
return;
if (LoggedIn)
{
if (timeoutTimer != null)
timeoutTimer.Change(timeoutInterval, timeoutInterval); // Reset time before timing out
else
return;
if (keepAliveTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE)
{
if (LoggedIn)
LoggedinUser.Idle = false;
keepAliveTimer.Change(oneMinute, oneMinute);
}
else
{
return;
if (keepAliveTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE)
{
if (LoggedIn)
LoggedinUser.Idle = false;
keepAliveTimer.Change(oneMinute, oneMinute);
}
else
{
return;
}
}
if (kickTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE)
@ -437,7 +440,6 @@ namespace HISP.Server
warnTimer.Change(warnInterval, warnInterval);
else
return;
}
catch (ObjectDisposedException)
{
@ -454,12 +456,11 @@ namespace HISP.Server
{
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)
{
case PacketBuilder.PACKET_FLASH_XML_CROSSDOMAIN:
GameServer.OnCrossdomainPolicyRequest(this, Packet);
break;
case PacketBuilder.PACKET_LOGIN:
GameServer.OnLoginRequest(this, Packet);
break;
@ -547,10 +548,7 @@ namespace HISP.Server
}
catch(Exception e)
{
Logger.ErrorPrint("Unhandled Exception: " + e.ToString());
Logger.ErrorPrint(e.Message);
Logger.ErrorPrint("");
Logger.ErrorPrint(e.StackTrace);
Logger.ErrorPrint("Unhandled Exception: " + e.ToString() + "\n" + e.Message + "\n" + e.StackTrace);
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)

View file

@ -13,7 +13,8 @@ namespace HISP.Server
public const byte PACKET_TERMINATOR = 0x00;
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_CHAT = 0x14;