diff --git a/jellyfin-api/api/jellyfin-api.api b/jellyfin-api/api/jellyfin-api.api index 7f9a49f07..5790590c5 100644 --- a/jellyfin-api/api/jellyfin-api.api +++ b/jellyfin-api/api/jellyfin-api.api @@ -20,15 +20,19 @@ public final class org/jellyfin/sdk/api/client/ApiClient$DefaultImpls { public final class org/jellyfin/sdk/api/client/HttpClientOptions { public fun ()V - public fun (ZJ)V - public synthetic fun (ZJILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (ZJJJ)V + public synthetic fun (ZJJJILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Z public final fun component2 ()J - public final fun copy (ZJ)Lorg/jellyfin/sdk/api/client/HttpClientOptions; - public static synthetic fun copy$default (Lorg/jellyfin/sdk/api/client/HttpClientOptions;ZJILjava/lang/Object;)Lorg/jellyfin/sdk/api/client/HttpClientOptions; + public final fun component3 ()J + public final fun component4 ()J + public final fun copy (ZJJJ)Lorg/jellyfin/sdk/api/client/HttpClientOptions; + public static synthetic fun copy$default (Lorg/jellyfin/sdk/api/client/HttpClientOptions;ZJJJILjava/lang/Object;)Lorg/jellyfin/sdk/api/client/HttpClientOptions; public fun equals (Ljava/lang/Object;)Z + public final fun getConnectTimeout ()J public final fun getFollowRedirects ()Z - public final fun getTimeout ()J + public final fun getRequestTimeout ()J + public final fun getSocketTimeout ()J public fun hashCode ()I public fun toString ()Ljava/lang/String; } diff --git a/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/HttpClientOptions.kt b/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/HttpClientOptions.kt index 7366f5666..9432f0461 100644 --- a/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/HttpClientOptions.kt +++ b/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/HttpClientOptions.kt @@ -11,8 +11,20 @@ public data class HttpClientOptions( val followRedirects: Boolean = true, /** - * Timeout before a request failed. In milliseconds. + * Timeout for a complete HTTP request in milliseconds. + * Defaults to 30 seconds. + */ + val requestTimeout: Long = 30_000, + + /** + * Timeout for connecting to the server in milliseconds. * Defaults to 6 seconds. */ - val timeout: Long = 6_000 + val connectTimeout: Long = 6_000, + + /** + * Timeout between receiving or writing messages in milliseconds. + * Defaults to 10 seconds. + */ + val socketTimeout: Long = 10_000, ) diff --git a/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/KtorClient.kt b/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/KtorClient.kt index e50f0b2be..5032e14db 100644 --- a/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/KtorClient.kt +++ b/jellyfin-api/src/main/kotlin/org/jellyfin/sdk/api/client/KtorClient.kt @@ -48,7 +48,9 @@ public open class KtorClient( } install(HttpTimeout) { - connectTimeoutMillis = httpClientOptions.timeout + connectTimeoutMillis = httpClientOptions.connectTimeout + requestTimeoutMillis = httpClientOptions.requestTimeout + socketTimeoutMillis = httpClientOptions.socketTimeout } } diff --git a/jellyfin-core/src/main/kotlin/org/jellyfin/sdk/discovery/RecommendedServerDiscovery.kt b/jellyfin-core/src/main/kotlin/org/jellyfin/sdk/discovery/RecommendedServerDiscovery.kt index ab2764ab0..1ceabf9fd 100644 --- a/jellyfin-core/src/main/kotlin/org/jellyfin/sdk/discovery/RecommendedServerDiscovery.kt +++ b/jellyfin-core/src/main/kotlin/org/jellyfin/sdk/discovery/RecommendedServerDiscovery.kt @@ -71,7 +71,9 @@ public class RecommendedServerDiscovery( baseUrl = address, httpClientOptions = HttpClientOptions( followRedirects = false, - timeout = HTTP_TIMEOUT, + connectTimeout = HTTP_TIMEOUT, + requestTimeout = HTTP_TIMEOUT, + socketTimeout = HTTP_TIMEOUT, ), ) val api = SystemApi(client)