Initial Netty implementation for networking

Split into 1 LoginServer and 1 ChannelServer per channel.

There is still a lot of cleanup and refactoring to be done.
Currently, the reliance on IoSession holding client state
is the most pressing issue to be addressed.
This commit is contained in:
P0nk
2021-06-23 18:20:08 +02:00
parent 0fa6ad0e24
commit 9638d5c417
14 changed files with 259 additions and 45 deletions

View File

@@ -0,0 +1,23 @@
package net.netty;
import client.MapleClient;
import io.netty.channel.socket.SocketChannel;
import net.PacketProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoginServerInitializer extends ServerChannelInitializer {
private static final Logger log = LoggerFactory.getLogger(LoginServerInitializer.class);
@Override
public void initChannel(SocketChannel socketChannel) {
final String clientIp = socketChannel.remoteAddress().getHostName();
log.debug("Client connected to login server from {} ", clientIp);
PacketProcessor packetProcessor = PacketProcessor.getLoginServerProcessor();
final MapleClient client = new MapleClient(packetProcessor, LoginServer.WORLD, LoginServer.CHANNEL);
client.setSessionId(sessionId.getAndIncrement());
initPipeline(socketChannel, client);
}
}