Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 30a3cc1

Browse files
committed
Fix receiving data from connection pool workers at Windows
1 parent 84a1f0a commit 30a3cc1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ PostmasterMain(int argc, char *argv[])
10461046
* First, mark them all closed, and set up an on_proc_exit function that's
10471047
* charged with closing the sockets again at postmaster shutdown.
10481048
*/
1049-
for (i = 0; i < MAXLISTEN; i++)
1049+
for (i = 0; i < MAXLISTEN + MAX_CONNPOOL_WORKERS; i++)
10501050
ListenSocket[i] = PGINVALID_SOCKET;
10511051

10521052
on_proc_exit(CloseServerPorts, 0);
@@ -1443,7 +1443,7 @@ CloseServerPorts(int status, Datum arg)
14431443
* before we remove the postmaster.pid lockfile; otherwise there's a race
14441444
* condition if a new postmaster wants to re-use the TCP port number.
14451445
*/
1446-
for (i = 0; i < MAXLISTEN; i++)
1446+
for (i = 0; i < MAXLISTEN + MAX_CONNPOOL_WORKERS; i++)
14471447
{
14481448
if (ListenSocket[i] != PGINVALID_SOCKET)
14491449
{
@@ -2692,15 +2692,15 @@ PoolConnCreate(pgsocket poolFd, int workerId)
26922692
worker->state = CPW_FREE;
26932693

26942694
/* get size of data */
2695-
while ((rc = read(poolFd, &recv_len, sizeof recv_len)) < 0 && errno == EINTR);
2695+
while ((rc = recv(poolFd, &recv_len, sizeof recv_len, 0)) < 0 && errno == EINTR);
26962696

26972697
if (rc != (int) sizeof(recv_len))
26982698
goto io_error;
26992699

27002700
/* get the data */
27012701
for (offs = 0; offs < recv_len; offs += rc)
27022702
{
2703-
while ((rc = read(poolFd, recv_buf + offs, CONN_BUF_SIZE - offs)) < 0 && errno == EINTR);
2703+
while ((rc = recv(poolFd, recv_buf + offs, CONN_BUF_SIZE - offs, 0)) < 0 && errno == EINTR);
27042704
if (rc <= 0)
27052705
goto io_error;
27062706
}
@@ -2784,7 +2784,7 @@ ClosePostmasterPorts(bool am_syslogger)
27842784
#endif
27852785

27862786
/* Close the listen sockets */
2787-
for (i = 0; i < MAXLISTEN; i++)
2787+
for (i = 0; i < MAXLISTEN + MAX_CONNPOOL_WORKERS; i++)
27882788
{
27892789
if (ListenSocket[i] != PGINVALID_SOCKET)
27902790
{

0 commit comments

Comments
 (0)