From 89f7a192f90b5bcab4f1856126eb522344afe4cc Mon Sep 17 00:00:00 2001 From: Graham Date: Tue, 25 May 2021 22:52:41 +0100 Subject: [PATCH] Optimise inbound message matcher creation Signed-off-by: Graham --- .../openrs2/game/net/crossdomain/CrossDomainChannelHandler.kt | 2 +- .../main/kotlin/org/openrs2/game/net/http/HttpChannelHandler.kt | 2 +- .../org/openrs2/game/net/jaggrab/JaggrabChannelHandler.kt | 2 +- .../main/kotlin/org/openrs2/game/net/js5/Js5ChannelHandler.kt | 2 +- .../kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/game/src/main/kotlin/org/openrs2/game/net/crossdomain/CrossDomainChannelHandler.kt b/game/src/main/kotlin/org/openrs2/game/net/crossdomain/CrossDomainChannelHandler.kt index da3a905c..fa09f9ac 100644 --- a/game/src/main/kotlin/org/openrs2/game/net/crossdomain/CrossDomainChannelHandler.kt +++ b/game/src/main/kotlin/org/openrs2/game/net/crossdomain/CrossDomainChannelHandler.kt @@ -12,7 +12,7 @@ import org.openrs2.buffer.use import org.openrs2.game.net.http.Http @ChannelHandler.Sharable -public object CrossDomainChannelHandler : SimpleChannelInboundHandler() { +public object CrossDomainChannelHandler : SimpleChannelInboundHandler(HttpRequest::class.java) { private const val ENDPOINT = "/crossdomain.xml" private val POLICY = """ diff --git a/game/src/main/kotlin/org/openrs2/game/net/http/HttpChannelHandler.kt b/game/src/main/kotlin/org/openrs2/game/net/http/HttpChannelHandler.kt index 55368065..7e04fe86 100644 --- a/game/src/main/kotlin/org/openrs2/game/net/http/HttpChannelHandler.kt +++ b/game/src/main/kotlin/org/openrs2/game/net/http/HttpChannelHandler.kt @@ -16,7 +16,7 @@ import javax.inject.Singleton @ChannelHandler.Sharable public class HttpChannelHandler @Inject constructor( private val fileProvider: FileProvider -) : SimpleChannelInboundHandler() { +) : SimpleChannelInboundHandler(HttpRequest::class.java) { override fun channelActive(ctx: ChannelHandlerContext) { ctx.read() } diff --git a/game/src/main/kotlin/org/openrs2/game/net/jaggrab/JaggrabChannelHandler.kt b/game/src/main/kotlin/org/openrs2/game/net/jaggrab/JaggrabChannelHandler.kt index 1f3df460..b9c7f9b1 100644 --- a/game/src/main/kotlin/org/openrs2/game/net/jaggrab/JaggrabChannelHandler.kt +++ b/game/src/main/kotlin/org/openrs2/game/net/jaggrab/JaggrabChannelHandler.kt @@ -15,7 +15,7 @@ import javax.inject.Singleton @ChannelHandler.Sharable public class JaggrabChannelHandler @Inject constructor( private val fileProvider: FileProvider -) : SimpleChannelInboundHandler() { +) : SimpleChannelInboundHandler(JaggrabRequest::class.java) { override fun handlerAdded(ctx: ChannelHandlerContext) { ctx.read() } diff --git a/game/src/main/kotlin/org/openrs2/game/net/js5/Js5ChannelHandler.kt b/game/src/main/kotlin/org/openrs2/game/net/js5/Js5ChannelHandler.kt index d3f676ab..d40c117b 100644 --- a/game/src/main/kotlin/org/openrs2/game/net/js5/Js5ChannelHandler.kt +++ b/game/src/main/kotlin/org/openrs2/game/net/js5/Js5ChannelHandler.kt @@ -9,7 +9,7 @@ import javax.inject.Inject public class Js5ChannelHandler @Inject constructor( private val service: Js5Service -) : SimpleChannelInboundHandler() { +) : SimpleChannelInboundHandler(Js5Request::class.java) { private lateinit var client: Js5Client override fun handlerAdded(ctx: ChannelHandlerContext) { diff --git a/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt b/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt index d55c029a..6d74b4ba 100644 --- a/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt +++ b/game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt @@ -29,7 +29,7 @@ import javax.inject.Provider public class LoginChannelHandler @Inject constructor( private val js5HandlerProvider: Provider, private val jaggrabHandler: JaggrabChannelHandler -) : SimpleChannelInboundHandler() { +) : SimpleChannelInboundHandler(LoginRequest::class.java) { override fun channelActive(ctx: ChannelHandlerContext) { ctx.read() }