NetClient disconnect() should call onDisconnection().
This commit is contained in:
@ -66,7 +66,6 @@ public class NetClient
|
||||
*/
|
||||
public void onDisconnection()
|
||||
{
|
||||
disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,6 +116,9 @@ public class NetClient
|
||||
{
|
||||
_pendingData = null;
|
||||
}
|
||||
|
||||
// Client is disconnected.
|
||||
onDisconnection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
||||
private void onDisconnection(E client)
|
||||
{
|
||||
_pool.remove(client);
|
||||
client.onDisconnection();
|
||||
client.disconnect();
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
||||
catch (Exception e)
|
||||
{
|
||||
_pool.remove(_client);
|
||||
_client.onDisconnection();
|
||||
_client.disconnect();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
||||
Disconnection.of(this).onDisconnection();
|
||||
}
|
||||
_connectionState = ConnectionState.DISCONNECTED;
|
||||
super.onDisconnection();
|
||||
}
|
||||
|
||||
public void closeNow()
|
||||
{
|
||||
onDisconnection();
|
||||
}
|
||||
|
||||
public void close(ServerPacket packet)
|
||||
{
|
||||
if (packet == null)
|
||||
{
|
||||
closeNow();
|
||||
disconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
||||
sendPacket(packet);
|
||||
|
||||
// Wait for packet to be sent.
|
||||
ThreadPool.schedule(this::closeNow, 1000);
|
||||
ThreadPool.schedule(this::disconnect, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.closeNow();
|
||||
client.disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
||||
{
|
||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||
{
|
||||
client.closeNow();
|
||||
client.disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
||||
final Player player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
client.closeNow();
|
||||
client.disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
||||
if (_version == -2)
|
||||
{
|
||||
// This is just a ping attempt from the new C2 client.
|
||||
client.closeNow();
|
||||
client.disconnect();
|
||||
}
|
||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||
{
|
||||
|
Reference in New Issue
Block a user