Refactor MapleClient constructor, fix issue with multiclient check

This commit is contained in:
P0nk
2021-07-18 16:27:41 +02:00
parent 850d44d549
commit 435cafd381
4 changed files with 42 additions and 12 deletions

View File

@@ -25,8 +25,9 @@ public class ChannelServerInitializer extends ServerChannelInitializer {
log.debug("Client connecting to world {}, channel {} from {}", world, channel, clientIp);
PacketProcessor packetProcessor = PacketProcessor.getChannelServerProcessor(world, channel);
final MapleClient client = new MapleClient(MapleClient.Type.CHANNEL, packetProcessor, world, channel);
client.setSessionId(sessionId.getAndIncrement());
final long clientSessionId = sessionId.getAndIncrement();
final String remoteAddress = getRemoteAddress(socketChannel);
final MapleClient client = MapleClient.createChannelClient(clientSessionId, remoteAddress, packetProcessor, world, channel);
if (Server.getInstance().getChannel(world, channel) == null) {
MapleSessionCoordinator.getInstance().closeSession(client, true);