diff --git a/game-server/src/main/kotlin/work/fking/pangya/game/net/HelloHandler.kt b/game-server/src/main/kotlin/work/fking/pangya/game/net/HelloHandler.kt index 7c020ff..604206c 100644 --- a/game-server/src/main/kotlin/work/fking/pangya/game/net/HelloHandler.kt +++ b/game-server/src/main/kotlin/work/fking/pangya/game/net/HelloHandler.kt @@ -27,8 +27,8 @@ class HelloHandler( val pipeline = ctx.pipeline() pipeline.remove(this) - pipeline.replace("encoder", "encoder", ProtocolEncoder(cryptKey)) - pipeline.addLast("framer", LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 10000, 1, 2, 1, 0, true)) + pipeline.replace("encoder", "protocolEncoder", ProtocolEncoder(cryptKey)) + pipeline.addLast("framer", LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 2500, 1, 2, 1, 0, true)) pipeline.addLast("handoverHandler", HandoverHandler(gameServer, cryptKey)) } } diff --git a/login-server/src/main/kotlin/work/fking/pangya/login/net/pipe/HelloHandler.kt b/login-server/src/main/kotlin/work/fking/pangya/login/net/pipe/HelloHandler.kt index fc316a0..814f180 100644 --- a/login-server/src/main/kotlin/work/fking/pangya/login/net/pipe/HelloHandler.kt +++ b/login-server/src/main/kotlin/work/fking/pangya/login/net/pipe/HelloHandler.kt @@ -1,6 +1,6 @@ package work.fking.pangya.login.net.pipe -import io.netty.channel.ChannelHandler +import io.netty.channel.ChannelHandler.Sharable import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelInboundHandlerAdapter import io.netty.handler.codec.LengthFieldBasedFrameDecoder @@ -14,7 +14,7 @@ import java.nio.ByteOrder private val LOGGER = LoggerFactory.getLogger(HelloHandler::class.java) -@ChannelHandler.Sharable +@Sharable class HelloHandler( private val loginServer: LoginServer ) : ChannelInboundHandlerAdapter() { @@ -24,10 +24,11 @@ class HelloHandler( val cryptKey = Rand.maxInclusive(PangCrypt.CRYPT_KEY_MAX) LOGGER.debug("New connection from {}, selected cryptKey={}", channel.remoteAddress(), cryptKey) ctx.writeAndFlush(HelloPacket(cryptKey)) + val pipeline = channel.pipeline() pipeline.remove(this) - pipeline.replace("encoder", "encoder", ProtocolEncoder(cryptKey)) - pipeline.addLast("framer", LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 10000, 1, 2, 1, 0, true)) + pipeline.replace("encoder", "protocolEncoder", ProtocolEncoder(cryptKey)) + pipeline.addLast("framer", LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 250, 1, 2, 1, 0, true)) pipeline.addLast("loginHandler", LoginHandler(loginServer, cryptKey)) } } \ No newline at end of file