Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: [PATCHES] Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL


  • From: Oliver Jowett <oliver(at)opencloud(dot)com>
  • To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • Cc: Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>, pgsql-patches(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org
  • Subject: Re: [PATCHES] Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL
  • Date: Mon, 12 Sep 2005 12:59:46 +1200
  • Message-id: <4324D302(dot)6080701(at)opencloud(dot)com>

Tom Lane wrote:
> So the postmaster-log message may be the best we can do ...
> but I don't think we should drop the connection.

Here's a patch to do that; it appears to work as intended on my Linux
system.

-O
Index: src/backend/libpq/pqcomm.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/libpq/pqcomm.c,v
retrieving revision 1.178
diff -c -r1.178 pqcomm.c
*** src/backend/libpq/pqcomm.c	30 Jul 2005 20:28:20 -0000	1.178
--- src/backend/libpq/pqcomm.c	12 Sep 2005 00:58:15 -0000
***************
*** 595,612 ****
  			return STATUS_ERROR;
  		}
  
! 		/* Set default keepalive parameters. This should also catch
! 		 * misconfigurations (non-zero values when socket options aren't
! 		 * supported)
  		 */
! 		if (pq_setkeepalivesidle(tcp_keepalives_idle, port) != STATUS_OK)
! 			return STATUS_ERROR;
! 
! 		if (pq_setkeepalivesinterval(tcp_keepalives_interval, port) != STATUS_OK)
! 			return STATUS_ERROR;
! 
! 		if (pq_setkeepalivescount(tcp_keepalives_count, port) != STATUS_OK)
! 			return STATUS_ERROR;
  	}
  
  	return STATUS_OK;
--- 595,607 ----
  			return STATUS_ERROR;
  		}
  
! 		/* Set default keepalive parameters. We ignore misconfigurations
! 		 * that cause errors -- they will be logged, but won't kill the
! 		 * connection.
  		 */
! 		pq_setkeepalivesidle(tcp_keepalives_idle, port);
! 		pq_setkeepalivesinterval(tcp_keepalives_interval, port);
! 		pq_setkeepalivescount(tcp_keepalives_count, port);
  	}
  
  	return STATUS_OK;


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group