Fixed login issues after latest eclipse corrections.

This commit is contained in:
MobiusDev
2017-09-30 14:46:18 +00:00
parent f85299668b
commit 291b59aa9e
14 changed files with 128 additions and 53 deletions

View File

@ -323,21 +323,39 @@ public class LoginController
_bannedIps.putIfAbsent(address, System.currentTimeMillis() + duration);
}
public boolean isBannedAddress(InetAddress address) throws UnknownHostException
public boolean isBannedAddress(InetAddress address)
{
final String[] parts = address.getHostAddress().split("\\.");
Long bi = _bannedIps.get(address);
if (bi == null)
{
bi = _bannedIps.get(InetAddress.getByName(parts[0] + "." + parts[1] + "." + parts[2] + ".0"));
try
{
bi = _bannedIps.get(InetAddress.getByName(parts[0] + "." + parts[1] + "." + parts[2] + ".0"));
}
catch (UnknownHostException e)
{
}
}
if (bi == null)
{
bi = _bannedIps.get(InetAddress.getByName(parts[0] + "." + parts[1] + ".0.0"));
try
{
bi = _bannedIps.get(InetAddress.getByName(parts[0] + "." + parts[1] + ".0.0"));
}
catch (UnknownHostException e)
{
}
}
if (bi == null)
{
bi = _bannedIps.get(InetAddress.getByName(parts[0] + ".0.0.0"));
try
{
bi = _bannedIps.get(InetAddress.getByName(parts[0] + ".0.0.0"));
}
catch (UnknownHostException e)
{
}
}
if (bi != null)
{

View File

@ -16,7 +16,6 @@
*/
package com.l2jmobius.loginserver;
import java.net.UnknownHostException;
import java.nio.channels.SocketChannel;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -60,7 +59,7 @@ public class SelectorHelper implements IMMOExecutor<L2LoginClient>, IClientFacto
}
@Override
public boolean accept(SocketChannel sc) throws UnknownHostException
public boolean accept(SocketChannel sc)
{
return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress());
}

View File

@ -16,7 +16,6 @@
*/
package com.l2jmobius.loginserver.network.mmocore;
import java.net.UnknownHostException;
import java.nio.channels.SocketChannel;
/**
@ -24,5 +23,5 @@ import java.nio.channels.SocketChannel;
*/
public interface IAcceptFilter
{
boolean accept(SocketChannel sc) throws UnknownHostException;
boolean accept(SocketChannel sc);
}