fix player disconnecting cancelling protocol detection

This commit is contained in:
creeper123123321 2022-07-01 09:56:01 -03:00
parent fe95bd2090
commit fa3d59c5b0

View File

@ -24,16 +24,17 @@ import io.netty.channel.ChannelOption
import io.netty.handler.timeout.ReadTimeoutHandler import io.netty.handler.timeout.ReadTimeoutHandler
import io.netty.resolver.NoopAddressResolverGroup import io.netty.resolver.NoopAddressResolverGroup
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.net.InetSocketAddress import java.net.InetSocketAddress
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
object ProtocolDetector { object ProtocolDetector {
val coroutineScope = CoroutineScope(SupervisorJob())
private val loader = CacheLoader.from<InetSocketAddress, CompletableFuture<ProtocolVersion>> { address -> private val loader = CacheLoader.from<InetSocketAddress, CompletableFuture<ProtocolVersion>> { address ->
val future = CompletableFuture<ProtocolVersion>() val future = CompletableFuture<ProtocolVersion>()
CoroutineScope(Job()).launch { coroutineScope.launch {
try { try {
val proxyUri = VIAaaSConfig.backendProxy val proxyUri = VIAaaSConfig.backendProxy
val proxySocket = if (proxyUri == null) null else { val proxySocket = if (proxyUri == null) null else {