]> granicus.if.org Git - postgresql/commitdiff
Call getsockopt() on the correct socket.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 6 Jul 2015 13:36:48 +0000 (16:36 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 6 Jul 2015 13:36:48 +0000 (16:36 +0300)
We're interested in the buffer size of the socket that's connected to the
client, not the one that's listening for new connections. It happened to
work, as default buffer size is the same on both, but it was clearly not
wrong.

Spotted by Tom Lane

src/backend/libpq/pqcomm.c

index 9f92e4efae7660f7e49688860f4c54f1ba0785bf..b27ac952173173115cbabe2fc38684f92590a4ee 100644 (file)
@@ -773,7 +773,7 @@ StreamConnection(pgsocket server_fd, Port *port)
                 * https://msdn.microsoft.com/en-us/library/bb736549%28v=vs.85%29.aspx
                 */
                optlen = sizeof(oldopt);
-               if (getsockopt(server_fd, SOL_SOCKET, SO_SNDBUF, (char *) &oldopt,
+               if (getsockopt(port->sock, SOL_SOCKET, SO_SNDBUF, (char *) &oldopt,
                                           &optlen) < 0)
                {
                        elog(LOG, "getsockopt(SO_SNDBUF) failed: %m");