Skip to content

Commit 4d985ea

Browse files
committed
StreamConnection(): setsockopt (..., TCP_NODELAY, ...) added.
1 parent 329fb11 commit 4d985ea

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/backend/libpq/pqcomm.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.14 1997/03/20 18:21:35 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.15 1997/04/16 06:25:13 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -44,6 +44,7 @@
4444
#include <sys/socket.h>
4545
#include <netdb.h>
4646
#include <netinet/in.h>
47+
#include <netinet/tcp.h>
4748
#include <arpa/inet.h>
4849

4950
#if defined(linux)
@@ -631,6 +632,23 @@ StreamConnection(int server_fd, Port *port)
631632
elog(WARN, "postmaster: StreamConnection: getsockname: %m");
632633
return(STATUS_ERROR);
633634
}
635+
{
636+
struct protoent *pe;
637+
int on=1;
638+
639+
pe = getprotobyname ("TCP");
640+
if ( pe == NULL )
641+
{
642+
elog(WARN, "postmaster: getprotobyname failed");
643+
return(STATUS_ERROR);
644+
}
645+
if ( setsockopt (port->sock, pe->p_proto, TCP_NODELAY,
646+
&on, sizeof (on)) < 0 )
647+
{
648+
elog(WARN, "postmaster: setsockopt failed");
649+
return(STATUS_ERROR);
650+
}
651+
}
634652

635653
port->mask = 1 << port->sock;
636654

0 commit comments

Comments
 (0)