Skip to content

Commit be0e8f7

Browse files
committed
connectDB(): setsockopt (..., TCP_NODELAY, ...) added.
1 parent 4d985ea commit be0e8f7

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.29 1997/04/15 19:08:13 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.30 1997/04/16 06:29:19 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -21,6 +21,7 @@
2121
#include <ctype.h>
2222
#include <string.h>
2323
#include <netdb.h>
24+
#include <netinet/tcp.h>
2425
#include <errno.h>
2526
#include <signal.h>
2627
#include <ctype.h> /* for isspace() */
@@ -476,7 +477,25 @@ connectDB(PGconn *conn)
476477
conn->pghost,conn->pgport);
477478
goto connect_errReturn;
478479
}
479-
480+
{
481+
struct protoent *pe;
482+
int on=1;
483+
484+
pe = getprotobyname ("TCP");
485+
if ( pe == NULL )
486+
{
487+
(void) sprintf(conn->errorMessage,
488+
"connectDB(): getprotobyname failed\n");
489+
goto connect_errReturn;
490+
}
491+
if ( setsockopt (port->sock, pe->p_proto, TCP_NODELAY,
492+
&on, sizeof (on)) < 0 )
493+
{
494+
(void) sprintf(conn->errorMessage,
495+
"connectDB(): setsockopt failed\n");
496+
goto connect_errReturn;
497+
}
498+
}
480499

481500
/* fill in the client address */
482501
if (getsockname(port->sock, (struct sockaddr *) &port->laddr,

0 commit comments

Comments
 (0)