Signed-off-by: Graham <gpe@openrs2.org>
@ -57,15 +57,21 @@ public class Js5ChannelHandler(
}
override fun channelReadComplete(ctx: ChannelHandlerContext) {
var flush = false
while (inFlightRequests.size < maxInFlightRequests) {
val request = pendingRequests.removeFirstOrNull() ?: break
inFlightRequests += request
ctx.write(request, ctx.voidPromise())
flush = true
if (flush) {
ctx.flush()
ctx.read()
override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) {
releaseGroups()