Skip to content

Commit

Permalink
Merge pull request #222 from KyoriPowered/renovate/major-ktor-monorepo
Browse files Browse the repository at this point in the history
chore(deps): Update ktor monorepo to v3 (major)
  • Loading branch information
zml2008 authored Nov 3, 2024
2 parents 96b12f7 + a0b2d0c commit 6926f22
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
adventure = "4.17.0"
kotlin = "2.0.21"
ktlint = "1.0.1"
ktor = "2.3.12"
ktor = "3.0.1"

[plugins]
indra-git = { id = "net.kyori.indra.git", version = "3.1.3" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import io.ktor.server.websocket.WebSockets
import io.ktor.server.websocket.pingPeriod
import io.ktor.server.websocket.timeout
import io.ktor.websocket.WebSocketDeflateExtension
import java.time.Duration
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds

public fun Application.main() {
install(Compression) {
Expand All @@ -36,8 +37,8 @@ public fun Application.main() {
}

install(WebSockets) {
pingPeriod = Duration.ofSeconds(15)
timeout = Duration.ofSeconds(5)
pingPeriod = 15.seconds
timeout = 5.seconds

extensions { install(WebSocketDeflateExtension) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package net.kyori.adventure.webui.jvm.minimessage

import io.ktor.http.HttpStatusCode
import io.ktor.server.application.Application
import io.ktor.server.application.call
import io.ktor.server.http.content.defaultResource
import io.ktor.server.http.content.resource
import io.ktor.server.http.content.resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import io.ktor.network.sockets.openWriteChannel
import io.ktor.server.application.Application
import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.ByteWriteChannel
import io.ktor.utils.io.close
import io.ktor.utils.io.readByte
import io.ktor.utils.io.readFully
import io.ktor.utils.io.readShort
import io.ktor.utils.io.writeByte
import io.ktor.utils.io.writeFully
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -97,7 +99,7 @@ public class ServerStatusPreviewManager(
}
}

sendChannel.close()
sendChannel.flushAndClose()
} catch (e: Exception) {
logger.error("An unknown error occurred whilst responding to a ping from ${socket.remoteAddress}", e)
}
Expand Down Expand Up @@ -157,11 +159,11 @@ public class ServerStatusPreviewManager(
var value = int
while (true) {
if ((value and 0x7F.inv()) == 0) {
writeByte(value)
writeByte(value.toByte())
return
}

writeByte((value and 0x7F) or 0x80)
writeByte(((value and 0x7F) or 0x80).toByte())

value = value ushr 7
}
Expand Down

0 comments on commit 6926f22

Please sign in to comment.