diff options
| author | Tom Lane | 2005-09-12 02:26:33 +0000 |
|---|---|---|
| committer | Tom Lane | 2005-09-12 02:26:33 +0000 |
| commit | cc3bda37f704dffb641a19d17d447e0eeb1a6c6c (patch) | |
| tree | 9144b085be25ef1a613cb4e1fb6cf494a73f0f29 /src/include | |
| parent | f7a5f90c464cc68d70255923a8bd5046e0baba37 (diff) | |
Tweak TCP-keepalive code so that an invalid setting doesn't cause us
to drop connections unceremoniously. Also some other marginal cleanups:
don't query getsockopt() repeatedly if it fails, and avoid having the
apparent definition of struct Port depend on which system headers you
might have included or not. Oliver Jowett and Tom Lane.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/libpq/libpq-be.h | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index bbc218a0e1e..b7d8e365821 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.50 2005/07/30 15:17:25 momjian Exp $ + * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.51 2005/09/12 02:26:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -86,6 +86,21 @@ typedef struct Port struct timeval session_start; /* for session duration logging */ /* + * TCP keepalive 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 were unable to find out the + * default (getsockopt failed). + */ + int default_keepalives_idle; + int default_keepalives_interval; + int default_keepalives_count; + int keepalives_idle; + int keepalives_interval; + int keepalives_count; + + /* * SSL structures */ #ifdef USE_SSL @@ -95,24 +110,6 @@ typedef struct Port char peer_cn[SM_USER + 1]; unsigned long count; #endif - - /* - * TCP keepalive settings; - * default values are 0 if AF_UNIX or not yet known; - * current values are 0 if AF_UNIX or using the default. - */ -#ifdef TCP_KEEPIDLE - int default_keepalives_idle; - int keepalives_idle; -#endif -#ifdef TCP_KEEPINTVL - int default_keepalives_interval; - int keepalives_interval; -#endif -#ifdef TCP_KEEPCNT - int default_keepalives_count; - int keepalives_count; -#endif } Port; |
