diff --git a/qcs-api-client-grpc/src/channel.rs b/qcs-api-client-grpc/src/channel.rs index a608b4d..01802be 100644 --- a/qcs-api-client-grpc/src/channel.rs +++ b/qcs-api-client-grpc/src/channel.rs @@ -102,9 +102,15 @@ pub fn get_endpoint(uri: Uri) -> Endpoint { } /// Get an [`Endpoint`] for the given [`Uri`] and timeout. -pub fn get_endpoint_with_timeout(uri: Uri, timeout: Option) -> Endpoint { +pub fn get_endpoint_with_timeout( + uri: Uri, + timeout: Option, + connection_timeout: Option, +) -> Endpoint { if let Some(duration) = timeout { - get_endpoint(uri).timeout(duration) + get_endpoint(uri) + .timeout(duration) + .connect_timeout(connection_timeout.unwrap_or_default()) } else { get_endpoint(uri) } @@ -149,7 +155,7 @@ pub fn get_channel(uri: Uri) -> Result { get_channel_with_endpoint(endpoint) } -/// Get a [`Channel`] to the given [`Uri`], with an optional timeout. If set to [`None`], no timeout is +/// Get a [`Channel`] to the given [`Uri`], with optional timeouts. If set to [`None`], no timeouts are /// used. /// Sets up things like user agent without setting up QCS credentials. /// @@ -164,8 +170,9 @@ pub fn get_channel(uri: Uri) -> Result { pub fn get_channel_with_timeout( uri: Uri, timeout: Option, + connection_timeout: Option, ) -> Result { - let endpoint = get_endpoint_with_timeout(uri, timeout); + let endpoint = get_endpoint_with_timeout(uri, timeout, connection_timeout); get_channel_with_endpoint(endpoint) }