Avoid directly utilizing the disconnect method for GameClient.

This commit is contained in:
MobiusDevelopment 2023-07-27 03:58:32 +03:00
parent 47b9dbd20f
commit c449a89a83
64 changed files with 95 additions and 62 deletions

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -91,11 +91,12 @@ public class GameClient extends NetClient
LOGGER_ACCOUNTING.finer("Client disconnected: " + this);
LoginServerThread.getInstance().sendLogout(_accountName);
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
synchronized (this)
{

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -40,6 +40,7 @@ public class Logout implements ClientPacket
final Player player = client.getPlayer();
if (player == null)
{
client.closeNow();
return;
}

View File

@ -79,11 +79,12 @@ public class GameClient extends NetClient
LOGGER_ACCOUNTING.finer("Client disconnected: " + this);
LoginServerThread.getInstance().sendLogout(_accountName);
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
synchronized (this)
{

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -40,6 +40,7 @@ public class Logout implements ClientPacket
final Player player = client.getPlayer();
if (player == null)
{
client.closeNow();
return;
}

View File

@ -85,11 +85,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -85,11 +85,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -88,11 +88,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}

View File

@ -97,11 +97,12 @@ public class GameClient extends NetClient
Disconnection.of(this).onDisconnection();
}
_connectionState = ConnectionState.DISCONNECTED;
super.onDisconnection();
}
public void closeNow()
{
disconnect();
onDisconnection();
}
public void close(ServerPacket packet)

View File

@ -43,7 +43,7 @@ public class PacketHandler implements PacketHandlerInterface<GameClient>
{
LOGGER.warning("PacketHandler: Problem receiving packet id from " + client);
LOGGER.warning(CommonUtil.getStackTrace(e));
client.disconnect();
client.closeNow();
return;
}