mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-24 12:25:39 +01:00
fix import, show backend address in login msg
This commit is contained in:
parent
1667bfe2ec
commit
5c01df5f28
@ -13,7 +13,7 @@ class MinecraftHandler(
|
||||
val data: ConnectionData,
|
||||
val frontEnd: Boolean
|
||||
) : SimpleChannelInboundHandler<Packet>() {
|
||||
var remoteAddress: SocketAddress? = null
|
||||
lateinit var remoteAddress: SocketAddress
|
||||
val other: Channel? get() = if (frontEnd) data.backChannel else data.frontChannel
|
||||
|
||||
override fun channelRead0(ctx: ChannelHandlerContext, packet: Packet) {
|
||||
|
@ -107,8 +107,8 @@ class LoginState : MinecraftConnectionState {
|
||||
parseUndashedId(playerId),
|
||||
backName!!,
|
||||
backHash,
|
||||
frontHandler.remoteAddress!!,
|
||||
backPublicKey
|
||||
frontHandler.remoteAddress,
|
||||
handler.data.backHandler!!.remoteAddress
|
||||
).whenCompleteAsync({ _, throwable ->
|
||||
if (throwable != null) {
|
||||
frontHandler.data.backHandler!!.disconnect("Online mode error: $throwable")
|
||||
|
@ -11,6 +11,7 @@ import io.ktor.websocket.*
|
||||
import kotlinx.coroutines.channels.consumeEach
|
||||
import org.slf4j.event.Level
|
||||
import java.nio.channels.ClosedChannelException
|
||||
import java.time.Duration
|
||||
|
||||
class ViaWebApp {
|
||||
fun Application.main() {
|
||||
|
@ -13,8 +13,8 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import us.myles.ViaVersion.api.Via
|
||||
import java.net.InetSocketAddress
|
||||
import java.net.SocketAddress
|
||||
import java.security.PublicKey
|
||||
import java.util.*
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@ -46,14 +46,18 @@ class WebDashboardServer {
|
||||
|
||||
suspend fun requestSessionJoin(
|
||||
id: UUID, name: String, hash: String,
|
||||
address: SocketAddress, backKey: PublicKey
|
||||
)
|
||||
: CompletableFuture<Unit> {
|
||||
address: SocketAddress, backAddress: SocketAddress
|
||||
): CompletableFuture<Unit> {
|
||||
val future = viaWebServer.pendingSessionHashes.get(hash)
|
||||
var sent = 0
|
||||
viaWebServer.listeners[id]?.forEach {
|
||||
it.ws.send(
|
||||
"""{"action": "session_hash_request", "user": "$name", "session_hash": "$hash", "message": "Client is $address"}""".trimMargin()
|
||||
JsonObject().also {
|
||||
it.addProperty("action", "session_hash_request")
|
||||
it.addProperty("user", name)
|
||||
it.addProperty("session_hash", hash)
|
||||
it.addProperty("message", "Client is $address, backend is $backAddress")
|
||||
}.toString()
|
||||
)
|
||||
it.ws.flush()
|
||||
sent++
|
||||
|
Loading…
Reference in New Issue
Block a user