* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: kqueue.c 398 2005-12-12 18:12:46Z nenolod $
+ * $Id: kqueue.c 3358 2007-04-03 09:34:38Z nenolod $
*/
#include "stdinc.h"
#include "libcharybdis.h"
-#define KE_LENGTH MAX_CLIENTS
+#define KE_LENGTH 128
/* jlemon goofed up and didn't add EV_SET until fbsd 4.3 */
EV_SET(kep, (uintptr_t) F->fd, filter, kep_flags, 0, 0, (void *) F);
- if(kqoff == kqmax)
+ if(++kqoff == kqmax)
{
int ret;
}
kqoff = 0;
}
- else
- {
- kqoff++;
- }
}
}
comm_setselect(int fd, fdlist_t list, unsigned int type, PF * handler,
void *client_data, time_t timeout)
{
- fde_t *F = &fd_table[fd];
+ fde_t *F = comm_locate_fd(fd);
s_assert(fd >= 0);
s_assert(F->flags.open);
{
int fd = (int) ke[i].ident;
PF *hdl = NULL;
- fde_t *F = &fd_table[fd];
+ fde_t *F = comm_locate_fd(fd);
if(ke[i].flags & EV_ERROR)
{
/* XXX error == bad! -- adrian */
continue; /* XXX! */
}
+ if (F == NULL)
+ {
+ /* XXX this is because of our "queueing" of
+ * kqueue changes so we may get ones for fds
+ * we have already closed? -- jilles */
+ continue;
+ }
switch (ke[i].filter)
{