]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - libcharybdis/poll.c
Remove silly a2client_p, entirely pointless since User.server removal.
[irc/rqf/shadowircd.git] / libcharybdis / poll.c
index 73cb31e0600282ab5319cc3c022ec4a89220bf8b..407fb619b9efa411b443062cc88386126e579550 100644 (file)
@@ -22,7 +22,7 @@
  *  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"
@@ -63,14 +63,15 @@ void
 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
@@ -127,6 +128,9 @@ poll_update_pollfds(int fd, short event, PF * handler)
 
        resize_poll_array(fd);
 
+       if (F == NULL)
+               F = comm_add_fd(fd);
+
        if(F->comm_index < 0)
                F->comm_index = poll_findslot();