auto connect: fix version detection, resolve server address

This commit is contained in:
Bixilon 2023-01-28 00:45:01 +01:00
parent 7ff18cce79
commit 7907d579a3
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,6 @@ class StatusS2CP(buffer: InByteBuffer) : StatusS2CPacket {
val status: ServerStatus = ServerStatus(buffer.readJson())
override fun handle(connection: StatusConnection) {
connection.status = status
val version: Version? = Versions.getByProtocol(status.protocolId ?: -1)
if (version == null) {
Log.log(LogMessageType.NETWORK_STATUS, LogLevels.WARN) { "Server is running on unknown version (protocolId=${status.protocolId})" }
@ -41,6 +40,7 @@ class StatusS2CP(buffer: InByteBuffer) : StatusS2CPacket {
connection.serverVersion = version
}
connection.status = status
val ping = StatusPing()
connection.ping = ping
connection.state = StatusConnectionStates.QUERYING_PING

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -69,6 +69,6 @@ object AutoConnect {
return
}
autoConnect(DNSUtil.getServerAddress(address), version, account)
autoConnect(DNSUtil.resolveServerAddress(address).first(), version, account)
}
}