X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Feventl.c;h=ba4ba599272e13c5a24f7e2addca3a0689ea55d7;hb=37ae4386bd764d62ae43c68df1560be55ff813ca;hp=89138c29a902baeec3b313afc1df3bb476fe0d4c;hpb=24ad8ea356d71c764af19897e2719670a94a3a05;p=pazpar2-moved-to-github.git diff --git a/src/eventl.c b/src/eventl.c index 89138c2..ba4ba59 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -131,8 +131,8 @@ iochan_man_t iochan_man_create(int no_threads, int max_sockets) #endif if (max_sockets) man->limit_fd = max_sockets; - yaz_log(YLOG_LOG, "iochan max threads %d max sockets %d", - no_threads, max_sockets); + yaz_log(YLOG_LOG, "iochan threads %d limit fd %d", no_threads, + man->limit_fd); yaz_mutex_create(&man->iochan_mutex); return man; } @@ -168,7 +168,7 @@ void iochan_man_destroy(iochan_man_t *mp) } } -int iochan_add(iochan_man_t man, IOCHAN chan) +int iochan_add(iochan_man_t man, IOCHAN chan, int slack) { int r = 0, no_fds = 0; IOCHAN p; @@ -181,7 +181,7 @@ int iochan_add(iochan_man_t man, IOCHAN chan) if (p->fd >= 0) no_fds++; } - if (chan->fd > 0 && man->limit_fd > 0 && no_fds >= man->limit_fd) + if (slack >= 0 && man->limit_fd > 0 && no_fds >= man->limit_fd - slack) { r = -1; yaz_log(YLOG_WARN, "max channels %d in use", no_fds);