X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fengine_select.c;h=436f10baa1122b86007990d1c0fc922a919879e2;hb=01586bad04d3de9641d7632910ae89352f38f02d;hp=e759967bc2516cac472ceb57848f9a67e6e5ba83;hpb=e5fa429e2429bff9c1344a810ed97a8c47362b04;p=ircu2.10.12-pk.git diff --git a/ircd/engine_select.c b/ircd/engine_select.c index e759967..436f10b 100644 --- a/ircd/engine_select.c +++ b/ircd/engine_select.c @@ -22,20 +22,20 @@ */ #include "config.h" -#include "ircd_events.h" - -#include "ircd.h" -#include "ircd_log.h" -#include "s_debug.h" - /* On BSD, define FD_SETSIZE to what we want before including sys/types.h */ #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__) # if !defined(FD_SETSIZE) -# define FD_SETSIZE MAXCONNECTIONS +# define FD_SETSIZE ((MAXCONNECTIONS)+4) # endif #endif -#include +#include "ircd_events.h" + +#include "ircd.h" +#include "ircd_log.h" +#include "s_debug.h" + +/* #include -- Now using assert in ircd_log.h */ #include #include /* needed for bzero() on OS X */ #include @@ -44,6 +44,20 @@ #include #include +#if FD_SETSIZE < (MAXCONNECTIONS + 4) +/* + * Sanity check + * + * All operating systems work when MAXCONNECTIONS <= 252. + * Most operating systems work when MAXCONNECTIONS <= 1020 and FD_SETSIZE is + * updated correctly in the system headers (on BSD systems sys/types.h might + * have abruptly redefined it so the check is still done), you might + * already need to recompile your kernel. + * For larger FD_SETSIZE your mileage may vary (kernel patches may be needed). + */ +# error FD_SETSIZE is too small or MAXCONNECTIONS too large. +#endif + #define SELECT_ERROR_THRESHOLD 20 /**< after 20 select errors, restart */ #define ERROR_EXPIRE_TIME 3600 /**< expire errors after an hour */ @@ -251,7 +265,7 @@ engine_loop(struct Generators* gen) int nfds; int i; int errcode; - size_t codesize; + socklen_t codesize; struct Socket *sock; while (running) { @@ -389,8 +403,6 @@ engine_loop(struct Generators* gen) break; } - assert(s_fd(sock) == i); - gen_ref_dec(sock); /* we're done with it */ }