pub struct TimeoutConfig {
pub connect_timeout: Duration,
pub tls_timeout: Duration,
pub login_timeout: Duration,
pub command_timeout: Duration,
pub idle_timeout: Duration,
pub keepalive_interval: Option<Duration>,
}Expand description
Timeout configuration for various connection phases.
Per ARCHITECTURE.md §4.4, different phases of connection and command execution have separate timeout controls.
Fields§
§connect_timeout: DurationTime to establish TCP connection (default: 15s).
tls_timeout: DurationTime to complete TLS handshake (default: 10s).
login_timeout: DurationTime to complete login sequence (default: 30s).
command_timeout: DurationDefault timeout for command execution (default: 30s).
Applied to every command path — query, execute, named-parameter
and multi-result variants, stored-procedure calls, and bulk-insert
network phases. On expiry the driver sends an Attention packet to
cancel the command, drains the acknowledgement (bounded at 5 s), and
returns Error::CommandTimeout with
the connection left usable. Exceptions that abandon the connection
instead of cancelling: a server that never acknowledges the
attention, and a timeout during the bulk-load data transfer (an
Attention cannot be interleaved into a partially-sent BulkLoad
message). Set to Duration::ZERO for no limit (matching ADO.NET’s
CommandTimeout = 0).
idle_timeout: DurationTime before idle connection is closed (default: 300s).
keepalive_interval: Option<Duration>Interval for connection keep-alive (default: 30s).
Implementations§
Source§impl TimeoutConfig
impl TimeoutConfig
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
Set the TCP connection timeout.
Sourcepub fn tls_timeout(self, timeout: Duration) -> Self
pub fn tls_timeout(self, timeout: Duration) -> Self
Set the TLS handshake timeout.
Sourcepub fn login_timeout(self, timeout: Duration) -> Self
pub fn login_timeout(self, timeout: Duration) -> Self
Set the login sequence timeout.
Sourcepub fn command_timeout(self, timeout: Duration) -> Self
pub fn command_timeout(self, timeout: Duration) -> Self
Set the default command execution timeout.
Sourcepub fn idle_timeout(self, timeout: Duration) -> Self
pub fn idle_timeout(self, timeout: Duration) -> Self
Set the idle connection timeout.
Sourcepub fn keepalive_interval(self, interval: Option<Duration>) -> Self
pub fn keepalive_interval(self, interval: Option<Duration>) -> Self
Set the keep-alive interval.
Sourcepub fn no_keepalive(self) -> Self
pub fn no_keepalive(self) -> Self
Disable keep-alive.
Sourcepub fn total_connect_timeout(&self) -> Duration
pub fn total_connect_timeout(&self) -> Duration
Get the total time allowed for a full connection (TCP + TLS + login).
Trait Implementations§
Source§impl Clone for TimeoutConfig
impl Clone for TimeoutConfig
Source§fn clone(&self) -> TimeoutConfig
fn clone(&self) -> TimeoutConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more