Update mina to 2.0.19 + fix exceptionCaught code (#398)
This commit is contained in:
BIN
cores/mina-core-2.0.19.jar
Normal file
BIN
cores/mina-core-2.0.19.jar
Normal file
Binary file not shown.
Binary file not shown.
@@ -88,33 +88,12 @@ public class MapleServerHandler extends IoHandlerAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(IoSession session, Throwable cause) {
|
public void exceptionCaught(IoSession session, Throwable cause) {
|
||||||
if (cause instanceof org.apache.mina.core.write.WriteToClosedSessionException) {
|
if (cause instanceof IOException) { // mina closes session automatically and does not call sessionClosed on IOException
|
||||||
return;
|
session.closeNow(); // calls sessionClosed
|
||||||
}
|
} else {
|
||||||
|
MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
|
||||||
|
|
||||||
/*
|
if (client != null && client.getPlayer() != null) {
|
||||||
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) {
|
|
||||||
FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, cause, "Exception caught by: " + client.getPlayer());
|
FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, cause, "Exception caught by: " + client.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user