Turnabout on Character stats concurrency + Null remote IP patch
Cleared the concurrency conflicts that started occuring after the abstract character's listener code was set to run on new thread, potentally leading to several onStatChange mishaps. Added a check for remoteHost being possibly null when opening a new session with the client.
This commit is contained in:
@@ -106,7 +106,18 @@ public class MapleServerHandler extends IoHandlerAdapter {
|
||||
|
||||
@Override
|
||||
public void sessionOpened(IoSession session) {
|
||||
session.setAttribute(MapleClient.CLIENT_REMOTE_ADDRESS, ((InetSocketAddress) session.getRemoteAddress()).getAddress().getHostAddress());
|
||||
String remoteHost;
|
||||
try {
|
||||
remoteHost = ((InetSocketAddress) session.getRemoteAddress()).getAddress().getHostAddress();
|
||||
|
||||
if (remoteHost == null) {
|
||||
remoteHost = "null";
|
||||
}
|
||||
} catch (NullPointerException npe) { // thanks Agassy, Alchemist for pointing out possibility of remoteHost = null.
|
||||
remoteHost = "null";
|
||||
}
|
||||
|
||||
session.setAttribute(MapleClient.CLIENT_REMOTE_ADDRESS, remoteHost);
|
||||
|
||||
if (!Server.getInstance().isOnline()) {
|
||||
MapleSessionCoordinator.getInstance().closeSession(session, true);
|
||||
|
||||
Reference in New Issue
Block a user