@@ -44,6 +44,9 @@ use tokio_postgres::{Error, Socket};
44
44
/// omitted or the empty string.
45
45
/// * `connect_timeout` - The time limit in seconds applied to each socket-level connection attempt. Note that hostnames
46
46
/// can resolve to multiple IP addresses, and this limit is applied to each address. Defaults to no timeout.
47
+ /// * `tcp_user_timeout` - The time limit that transmitted data may remain unacknowledged before a connection is forcibly closed.
48
+ /// This is ignored for Unix domain socket connections. It is only supported on systems where TCP_USER_TIMEOUT is available
49
+ /// and will default to the system default if omitted or set to 0; on other systems, it has no effect.
47
50
/// * `keepalives` - Controls the use of TCP keepalive. A value of 0 disables keepalive and nonzero integers enable it.
48
51
/// This option is ignored when connecting with Unix sockets. Defaults to on.
49
52
/// * `keepalives_idle` - The number of seconds of inactivity after which a keepalive message is sent to the server.
@@ -256,6 +259,22 @@ impl Config {
256
259
self . config . get_connect_timeout ( )
257
260
}
258
261
262
+ /// Sets the TCP user timeout.
263
+ ///
264
+ /// This is ignored for Unix domain socket connections. It is only supported on systems where
265
+ /// TCP_USER_TIMEOUT is available and will default to the system default if omitted or set to 0;
266
+ /// on other systems, it has no effect.
267
+ pub fn tcp_user_timeout ( & mut self , tcp_user_timeout : Duration ) -> & mut Config {
268
+ self . config . tcp_user_timeout ( tcp_user_timeout) ;
269
+ self
270
+ }
271
+
272
+ /// Gets the TCP user timeout, if one has been set with the
273
+ /// `user_timeout` method.
274
+ pub fn get_tcp_user_timeout ( & self ) -> Option < & Duration > {
275
+ self . config . get_tcp_user_timeout ( )
276
+ }
277
+
259
278
/// Controls the use of TCP keepalive.
260
279
///
261
280
/// This is ignored for Unix domain socket connections. Defaults to `true`.
0 commit comments