Disconnect client by throwing exception in handler
This makes it easier to add checks in handlers, which should improve security over time. I think this approach is more readable and testable than calling Client#disconnect straight up, while it also decentralizes the handling.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package net.netty;
|
||||
|
||||
import client.Client;
|
||||
import database.character.CharacterSaver;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import net.PacketProcessor;
|
||||
import net.server.coordinator.session.SessionCoordinator;
|
||||
@@ -10,6 +11,10 @@ import org.slf4j.LoggerFactory;
|
||||
public class LoginServerInitializer extends ServerChannelInitializer {
|
||||
private static final Logger log = LoggerFactory.getLogger(LoginServerInitializer.class);
|
||||
|
||||
public LoginServerInitializer(CharacterSaver characterSaver) {
|
||||
super(characterSaver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initChannel(SocketChannel socketChannel) {
|
||||
final String clientIp = socketChannel.remoteAddress().getHostString();
|
||||
|
||||
Reference in New Issue
Block a user