1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Move HAPROXY_SOURCE constant to companion object.

It's an error to redefine an attribute key and thus the image server would fail to restart for events such as client setting changes.
This commit is contained in:
Erek Speed 2021-07-05 20:16:21 +09:00
parent 610300c2e4
commit 4b708bc6f1
No known key found for this signature in database
GPG key ID: 12933BB2EAD9F705

View file

@ -155,6 +155,7 @@ class Netty(
private val devSettings: DevSettings,
private val statistics: Statistics
) : ServerConfig {
override fun toServer(http: HttpHandler): Http4kServer = object : Http4kServer {
private val transport = NettyTransport.bestForPlatform(serverSettings.threads)
@ -182,7 +183,6 @@ class Netty(
bootstrap.group(transport.bossGroup, transport.workerGroup)
.channelFactory(transport.factory)
.childHandler(object : ChannelInitializer<SocketChannel>() {
val HAPROXY_SOURCE = AttributeKey.newInstance<String>("haproxy_source")
public override fun initChannel(ch: SocketChannel) {
if (serverSettings.enableProxyProtocol) {
ch.pipeline().addLast(
@ -315,6 +315,7 @@ class Netty(
companion object {
private val LOGGER = LoggerFactory.getLogger(Netty::class.java)
private val HAPROXY_SOURCE = AttributeKey.newInstance<String>("haproxy_source")
}
}