summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuo Ishii2000-05-20 13:10:54 +0000
committerTatsuo Ishii2000-05-20 13:10:54 +0000
commitf1cb756c38982a3b4690b6860da77e3473215c50 (patch)
tree83e3bcc14127cad854b8d6c26c9655e7f3fff32c
parent0d62ecdf72e2fbe756d5437c9f2b41778d9629ad (diff)
Add KEEPALIVE option to the socket of backend. This will automatically
terminate the backend that has no frontend anymore.
-rw-r--r--src/backend/libpq/pqcomm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index b761d34f415..7d2f7eb7d68 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -29,7 +29,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.89 2000/04/14 00:51:58 tgl Exp $
+ * $Id: pqcomm.c,v 1.90 2000/05/20 13:10:54 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -375,7 +375,13 @@ StreamConnection(int server_fd, Port *port)
if (setsockopt(port->sock, pe->p_proto, TCP_NODELAY,
&on, sizeof(on)) < 0)
{
- perror("postmaster: StreamConnection: setsockopt");
+ perror("postmaster: StreamConnection: setsockopt(TCP_NODELAY)");
+ return STATUS_ERROR;
+ }
+ if (setsockopt(port->sock, SOL_SOCKET, SO_KEEPALIVE,
+ &on, sizeof(on)) < 0)
+ {
+ perror("postmaster: StreamConnection: setsockopt(SO_KEEPALIVE)");
return STATUS_ERROR;
}
}