From 4d985ea96b418ff782a1a2a2237ca399a36a9616 Mon Sep 17 00:00:00 2001
From: "Vadim B. Mikheev" <vadim4o@yahoo.com>
Date: Wed, 16 Apr 1997 06:25:13 +0000
Subject: [PATCH] StreamConnection(): setsockopt (..., TCP_NODELAY, ...) added.

---
 src/backend/libpq/pqcomm.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 52309d4ddc0..dcd99cbe1b4 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.14 1997/03/20 18:21:35 scrappy Exp $
+ *    $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.15 1997/04/16 06:25:13 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -44,6 +44,7 @@
 #include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <arpa/inet.h>
 
 #if defined(linux)
@@ -631,6 +632,23 @@ StreamConnection(int server_fd, Port *port)
 	elog(WARN, "postmaster: StreamConnection: getsockname: %m");
 	return(STATUS_ERROR);
     }
+    {
+    	struct protoent *pe;
+    	int on=1;
+    	
+    	pe = getprotobyname ("TCP");
+    	if ( pe == NULL )
+    	{
+	    elog(WARN, "postmaster: getprotobyname failed");
+	    return(STATUS_ERROR);
+	}
+    	if ( setsockopt (port->sock, pe->p_proto, TCP_NODELAY, 
+    						&on, sizeof (on)) < 0 )
+    	{
+	    elog(WARN, "postmaster: setsockopt failed");
+	    return(STATUS_ERROR);
+	}
+    }
     
     port->mask = 1 << port->sock;
 
-- 
GitLab