@@ -1046,7 +1046,7 @@ PostmasterMain(int argc, char *argv[])
1046
1046
* First, mark them all closed, and set up an on_proc_exit function that's
1047
1047
* charged with closing the sockets again at postmaster shutdown.
1048
1048
*/
1049
- for (i = 0 ; i < MAXLISTEN ; i ++ )
1049
+ for (i = 0 ; i < MAXLISTEN + MAX_CONNPOOL_WORKERS ; i ++ )
1050
1050
ListenSocket [i ] = PGINVALID_SOCKET ;
1051
1051
1052
1052
on_proc_exit (CloseServerPorts , 0 );
@@ -1443,7 +1443,7 @@ CloseServerPorts(int status, Datum arg)
1443
1443
* before we remove the postmaster.pid lockfile; otherwise there's a race
1444
1444
* condition if a new postmaster wants to re-use the TCP port number.
1445
1445
*/
1446
- for (i = 0 ; i < MAXLISTEN ; i ++ )
1446
+ for (i = 0 ; i < MAXLISTEN + MAX_CONNPOOL_WORKERS ; i ++ )
1447
1447
{
1448
1448
if (ListenSocket [i ] != PGINVALID_SOCKET )
1449
1449
{
@@ -2692,15 +2692,15 @@ PoolConnCreate(pgsocket poolFd, int workerId)
2692
2692
worker -> state = CPW_FREE ;
2693
2693
2694
2694
/* 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 );
2696
2696
2697
2697
if (rc != (int ) sizeof (recv_len ))
2698
2698
goto io_error ;
2699
2699
2700
2700
/* get the data */
2701
2701
for (offs = 0 ; offs < recv_len ; offs += rc )
2702
2702
{
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 );
2704
2704
if (rc <= 0 )
2705
2705
goto io_error ;
2706
2706
}
@@ -2784,7 +2784,7 @@ ClosePostmasterPorts(bool am_syslogger)
2784
2784
#endif
2785
2785
2786
2786
/* Close the listen sockets */
2787
- for (i = 0 ; i < MAXLISTEN ; i ++ )
2787
+ for (i = 0 ; i < MAXLISTEN + MAX_CONNPOOL_WORKERS ; i ++ )
2788
2788
{
2789
2789
if (ListenSocket [i ] != PGINVALID_SOCKET )
2790
2790
{
0 commit comments