* Initialise the masks for select() for the ports we are listening on. * Return the number of sockets to listen on. */
| 2223 | * Return the number of sockets to listen on. |
| 2224 | */ |
| 2225 | static int |
| 2226 | initMasks(fd_set *rmask) |
| 2227 | { |
| 2228 | int maxsock = -1; |
| 2229 | int i; |
| 2230 | |
| 2231 | FD_ZERO(rmask); |
| 2232 | |
| 2233 | for (i = 0; i < MAXLISTEN; i++) |
| 2234 | { |
| 2235 | int fd = ListenSocket[i]; |
| 2236 | |
| 2237 | if (fd == PGINVALID_SOCKET) |
| 2238 | break; |
| 2239 | FD_SET(fd, rmask); |
| 2240 | |
| 2241 | if (fd > maxsock) |
| 2242 | maxsock = fd; |
| 2243 | } |
| 2244 | |
| 2245 | return maxsock + 1; |
| 2246 | } |
| 2247 | |
| 2248 | /* |
| 2249 | * Once the flag is reset, libpq connections (e.g. FTS probe requests) should |