From d57b58f1c4ad1f636d99aa7c4801b11d820aca64 Mon Sep 17 00:00:00 2001 From: Brutus5000 Date: Sun, 21 Apr 2024 18:35:29 +0200 Subject: [PATCH] Fallback to coturn default port if not port provided in uri --- .../kotlin/com/faforever/ice/peering/CoturnServer.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kia-lib/src/main/kotlin/com/faforever/ice/peering/CoturnServer.kt b/kia-lib/src/main/kotlin/com/faforever/ice/peering/CoturnServer.kt index ed828d0..217606d 100644 --- a/kia-lib/src/main/kotlin/com/faforever/ice/peering/CoturnServer.kt +++ b/kia-lib/src/main/kotlin/com/faforever/ice/peering/CoturnServer.kt @@ -9,5 +9,12 @@ data class CoturnServer( val username: String? = null, val credential: String? = null, ) { - fun toUDPTransport() = TransportAddress(uri.host, uri.port, Transport.UDP) + companion object { + const val DEFAULT_PORT = 3478 + } + + fun toUDPTransport() = TransportAddress( + uri.host, + if(uri.port == -1) DEFAULT_PORT else uri.port, + Transport.UDP) }