Simplify netty

This commit is contained in:
carbotaniuman 2020-08-21 10:50:02 -05:00
parent bf750427cd
commit b7b4ec7566

View file

@ -42,7 +42,6 @@ import java.net.SocketException
import java.security.PrivateKey
import java.security.cert.CertificateFactory
import java.security.cert.X509Certificate
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicReference
import javax.net.ssl.SSLException
import mdnet.base.Constants
@ -127,9 +126,9 @@ class Netty(private val tls: TlsCert, private val serverSettings: ServerSettings
}
override fun stop() = apply {
masterGroup.shutdownGracefully(1, 15, TimeUnit.SECONDS).sync()
workerGroup.shutdownGracefully(1, 15, TimeUnit.SECONDS).sync()
closeFuture.sync()
closeFuture.cancel(false)
workerGroup.shutdownGracefully()
masterGroup.shutdownGracefully()
}
override fun port(): Int = if (serverSettings.clientPort > 0) serverSettings.clientPort else address.port