aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVadim B. Mikheev <vadim4o@yahoo.com>1997-04-16 06:29:19 +0000
committerVadim B. Mikheev <vadim4o@yahoo.com>1997-04-16 06:29:19 +0000
commitbe0e8f7fb01ed61780c1ddd45eecf3d315479bb3 (patch)
treecef27a3512dc5e0aa6c790104b7495141bd0b7a1 /src
parent4d985ea96b418ff782a1a2a2237ca399a36a9616 (diff)
downloadpostgresql-be0e8f7fb01ed61780c1ddd45eecf3d315479bb3.tar.gz
postgresql-be0e8f7fb01ed61780c1ddd45eecf3d315479bb3.zip
connectDB(): setsockopt (..., TCP_NODELAY, ...) added.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/libpq/fe-connect.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 9d02de5b526..d1ebdb62c1e 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.29 1997/04/15 19:08:13 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.30 1997/04/16 06:29:19 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,6 +21,7 @@
#include <ctype.h>
#include <string.h>
#include <netdb.h>
+#include <netinet/tcp.h>
#include <errno.h>
#include <signal.h>
#include <ctype.h> /* for isspace() */
@@ -476,7 +477,25 @@ connectDB(PGconn *conn)
conn->pghost,conn->pgport);
goto connect_errReturn;
}
-
+ {
+ struct protoent *pe;
+ int on=1;
+
+ pe = getprotobyname ("TCP");
+ if ( pe == NULL )
+ {
+ (void) sprintf(conn->errorMessage,
+ "connectDB(): getprotobyname failed\n");
+ goto connect_errReturn;
+ }
+ if ( setsockopt (port->sock, pe->p_proto, TCP_NODELAY,
+ &on, sizeof (on)) < 0 )
+ {
+ (void) sprintf(conn->errorMessage,
+ "connectDB(): setsockopt failed\n");
+ goto connect_errReturn;
+ }
+ }
/* fill in the client address */
if (getsockname(port->sock, (struct sockaddr *) &port->laddr,