|
|
@ -57,14 +57,20 @@ public class Js5ChannelHandler( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun channelReadComplete(ctx: ChannelHandlerContext) { |
|
|
|
override fun channelReadComplete(ctx: ChannelHandlerContext) { |
|
|
|
|
|
|
|
var flush = false |
|
|
|
|
|
|
|
|
|
|
|
while (inFlightRequests.size < maxInFlightRequests) { |
|
|
|
while (inFlightRequests.size < maxInFlightRequests) { |
|
|
|
val request = pendingRequests.removeFirstOrNull() ?: break |
|
|
|
val request = pendingRequests.removeFirstOrNull() ?: break |
|
|
|
inFlightRequests += request |
|
|
|
inFlightRequests += request |
|
|
|
ctx.write(request, ctx.voidPromise()) |
|
|
|
ctx.write(request, ctx.voidPromise()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flush = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.flush() |
|
|
|
if (flush) { |
|
|
|
ctx.read() |
|
|
|
ctx.flush() |
|
|
|
|
|
|
|
ctx.read() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) { |
|
|
|
override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) { |
|
|
|