Update mina to 2.0.19 + fix exceptionCaught code (#398)

This commit is contained in:
MedicOP
2019-02-06 22:06:03 +01:00
committed by Ronan Lana
parent 9bd7548df8
commit 7aa77285a1
3 changed files with 6 additions and 27 deletions

BIN
cores/mina-core-2.0.19.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -88,33 +88,12 @@ public class MapleServerHandler extends IoHandlerAdapter {
@Override
public void exceptionCaught(IoSession session, Throwable cause) {
if (cause instanceof org.apache.mina.core.write.WriteToClosedSessionException) {
return;
}
/*
System.out.println("disconnect by exception");
cause.printStackTrace();
*/
MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
if (client != null) {
if (cause instanceof IOException) { // mina closes session automatically and does not call sessionClosed on IOException
if (isLoginServerHandler()) {
MapleSessionCoordinator.getInstance().closeLoginSession(session);
} else {
MapleSessionCoordinator.getInstance().closeSession(session, null);
}
try {
client.disconnect(false, client.getPlayer() != null && client.getPlayer().getCashShop().isOpened());
} catch (Throwable t) {
FilePrinter.printError(FilePrinter.ACCOUNT_STUCK, t);
} finally {
session.removeAttribute(MapleClient.CLIENT_KEY);
}
} else if (client.getPlayer() != null) {
if (cause instanceof IOException) { // mina closes session automatically and does not call sessionClosed on IOException
session.closeNow(); // calls sessionClosed
} else {
MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
if (client != null && client.getPlayer() != null) {
FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, cause, "Exception caught by: " + client.getPlayer());
}
}