Skip to content

Commit

Permalink
Upgrade 2.5-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
alikemal.ocalan committed Feb 2, 2021
1 parent 91a0b93 commit 8d4f942
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ WORKDIR /bin/runner
RUN rm -rf /src

#-XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC
CMD ["java","-XX:MaxRAMPercentage=45", "-XshowSettings:vm","-Dio.netty.tryReflectionSetAccessible=true","--illegal-access=warn","--add-opens","java.base/jdk.internal.misc=ALL-UNNAMED","-cp","greentunnel4jvm.jar","com.github.alikemalocalan.greentunnel4jvm.HttpProxyServerKt"]
CMD ["java","-XX:MaxRAMPercentage=45", "-XshowSettings:vm","-Dio.netty.tryReflectionSetAccessible=true","--illegal-access=warn","--add-opens","java.base/jdk.internal.misc=ALL-UNNAMED","-cp","greentunnel4jvm.jar","com.github.alikemalocalan.greentunnel4jvm.ProxyServerKt"]
EXPOSE 8080
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ kotlin.code.style=official
kotlin_version=1.4.21-2
projectGroup=com.github.alikemalocalan
projectName=greentunnel4jvm
projectVersion=2.4-SNAPSHOT
projectVersion=2.5-SNAPSHOT
projectMainClassName=com.github.alikemalocalan.greentunnel4jvm.gui.Gui
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,20 @@ class ProxyClientHandler : ChannelInboundHandlerAdapter() {
ctx: ChannelHandlerContext,
request: HttpRequest
): Optional<Channel> =
kotlin.runCatching { request.toInetSocketAddress() }.fold(onSuccess = { remoteAddress ->
val remoteFuture = bootstrap
.group(ctx.channel().eventLoop()) // use the same EventLoop
.handler(ProxyRemoteHandler(ctx, request))
.connect(remoteAddress)

ctx.channel().config().isAutoRead = false // if remote connection has done, stop reading
remoteFuture.addListener {
ctx.channel().config().isAutoRead = true // connection is ready, enable AutoRead
}
kotlin.runCatching { request.toInetSocketAddress() }
.fold(onSuccess = { remoteAddress ->
val remoteFuture = bootstrap
.group(ctx.channel().eventLoop()) // use the same EventLoop
.handler(ProxyRemoteHandler(ctx, request))
.connect(remoteAddress)

ctx.channel().config().isAutoRead = false // if remote connection has done, stop reading
remoteFuture.addListener {
ctx.channel().config().isAutoRead = true // connection is ready, enable AutoRead
}

return Optional.of(remoteFuture.channel())
}, onFailure = { return Optional.empty<Channel>() })
return Optional.of(remoteFuture.channel())
}, onFailure = { return Optional.empty<Channel>() })


override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) {
Expand Down

0 comments on commit 8d4f942

Please sign in to comment.