* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: poll.c 3245 2007-03-05 18:41:14Z nenolod $
+ * $Id: poll.c 3528 2007-07-07 08:08:23Z nenolod $
*/
#include "config.h"
init_netio(void)
{
int fd;
+ int maxconn = comm_get_maxconnections();
- pollfd_list.pollfds = calloc(sizeof(struct pollfd), MAXCONNECTIONS);
+ pollfd_list.pollfds = calloc(sizeof(struct pollfd), maxconn);
- for (fd = 0; fd < MAXCONNECTIONS; fd++)
+ for (fd = 0; fd < maxconn; fd++)
pollfd_list.pollfds[fd].fd = -1;
pollfd_list.maxindex = 0;
- pollfd_list.allocated = MAXCONNECTIONS;
+ pollfd_list.allocated = maxconn;
}
static inline void
resize_poll_array(fd);
+ if (F == NULL)
+ F = comm_add_fd(fd);
+
if(F->comm_index < 0)
F->comm_index = poll_findslot();