NetClient disconnect() should call onDisconnection().
This commit is contained in:
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public class GameClient extends NetClient
|
|||||||
Disconnection.of(this).onDisconnection();
|
Disconnection.of(this).onDisconnection();
|
||||||
}
|
}
|
||||||
_connectionState = ConnectionState.DISCONNECTED;
|
_connectionState = ConnectionState.DISCONNECTED;
|
||||||
super.onDisconnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closeNow()
|
|
||||||
{
|
|
||||||
onDisconnection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(ServerPacket packet)
|
public void close(ServerPacket packet)
|
||||||
{
|
{
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
{
|
{
|
||||||
closeNow();
|
disconnect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -117,7 +111,7 @@ public class GameClient extends NetClient
|
|||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
|
|
||||||
// Wait for packet to be sent.
|
// 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("PacketHandler: Problem receiving packet id from " + client);
|
||||||
LOGGER.warning(CommonUtil.getStackTrace(e));
|
LOGGER.warning(CommonUtil.getStackTrace(e));
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class AuthLogin implements ClientPacket
|
|||||||
{
|
{
|
||||||
if (_loginName.isEmpty() || !client.isProtocolOk())
|
if (_loginName.isEmpty() || !client.isProtocolOk())
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class Logout implements ClientPacket
|
|||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class ProtocolVersion implements ClientPacket
|
|||||||
if (_version == -2)
|
if (_version == -2)
|
||||||
{
|
{
|
||||||
// This is just a ping attempt from the new C2 client.
|
// This is just a ping attempt from the new C2 client.
|
||||||
client.closeNow();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
else if (!Config.PROTOCOL_LIST.contains(_version))
|
else if (!Config.PROTOCOL_LIST.contains(_version))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,6 @@ public class NetClient
|
|||||||
*/
|
*/
|
||||||
public void onDisconnection()
|
public void onDisconnection()
|
||||||
{
|
{
|
||||||
disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +116,9 @@ public class NetClient
|
|||||||
{
|
{
|
||||||
_pendingData = null;
|
_pendingData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client is disconnected.
|
||||||
|
onDisconnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,6 +240,6 @@ public class ReadThread<E extends NetClient> implements Runnable
|
|||||||
private void onDisconnection(E client)
|
private void onDisconnection(E client)
|
||||||
{
|
{
|
||||||
_pool.remove(client);
|
_pool.remove(client);
|
||||||
client.onDisconnection();
|
client.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class SendThread<E extends NetClient> implements Runnable
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_pool.remove(_client);
|
_pool.remove(_client);
|
||||||
_client.onDisconnection();
|
_client.disconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ public class LoginServerThread extends Thread
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
savedClient.closeNow();
|
savedClient.disconnect();
|
||||||
_accountsInGameServer.remove(account);
|
_accountsInGameServer.remove(account);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user