summaryrefslogtreecommitdiff
path: root/src/include/libpq
diff options
context:
space:
mode:
authorMichael Paquier2019-04-06 06:23:37 +0000
committerMichael Paquier2019-04-06 06:23:37 +0000
commit249d64999615802752940e017ee5166e726bc7cd (patch)
tree0e66ac1723a854999e136e0c8cb3c3c4442b589d /src/include/libpq
parent959d00e9dbe4cfcf4a63bb655ac2c29a5e579246 (diff)
Add support TCP user timeout in libpq and the backend server
Similarly to the set of parameters for keepalive, a connection parameter for libpq is added as well as a backend GUC, called tcp_user_timeout. Increasing the TCP user timeout is useful to allow a connection to survive extended periods without end-to-end connection, and decreasing it allows application to fail faster. By default, the parameter is 0, which makes the connection use the system default, and follows a logic close to the keepalive parameters in its handling. When connecting through a Unix-socket domain, the parameters have no effect. Author: Ryohei Nagaura Reviewed-by: Fabien Coelho, Robert Haas, Kyotaro Horiguchi, Kirk Jamison, Mikalai Keida, Takayuki Tsunakawa, Andrei Yahorau Discussion: https://postgr.es/m/EDA4195584F5064680D8130B1CA91C45367328@G01JPEXMBYT04
Diffstat (limited to 'src/include/libpq')
-rw-r--r--src/include/libpq/libpq-be.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h
index b135ef9d9fd..00b1fbe4415 100644
--- a/src/include/libpq/libpq-be.h
+++ b/src/include/libpq/libpq-be.h
@@ -155,7 +155,7 @@ typedef struct Port
HbaLine *hba;
/*
- * TCP keepalive settings.
+ * TCP keepalive and user timeout settings.
*
* default values are 0 if AF_UNIX or not yet known; current values are 0
* if AF_UNIX or using the default. Also, -1 in a default value means we
@@ -164,9 +164,11 @@ typedef struct Port
int default_keepalives_idle;
int default_keepalives_interval;
int default_keepalives_count;
+ int default_tcp_user_timeout;
int keepalives_idle;
int keepalives_interval;
int keepalives_count;
+ int tcp_user_timeout;
/*
* GSSAPI structures.
@@ -306,9 +308,11 @@ extern ProtocolVersion FrontendProtocol;
extern int pq_getkeepalivesidle(Port *port);
extern int pq_getkeepalivesinterval(Port *port);
extern int pq_getkeepalivescount(Port *port);
+extern int pq_gettcpusertimeout(Port *port);
extern int pq_setkeepalivesidle(int idle, Port *port);
extern int pq_setkeepalivesinterval(int interval, Port *port);
extern int pq_setkeepalivescount(int count, Port *port);
+extern int pq_settcpusertimeout(int timeout, Port *port);
#endif /* LIBPQ_BE_H */