diff --git a/ChangeLog b/ChangeLog index 3e40af9..e25266a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +nenolod 2007/03/05 17:28:27 UTC (20070305-3233) + Log: + - clear up use of fd_table in ircd. + + + Changes: Modified: + +3 -2 trunk/src/s_serv.c (File Modified) + + nenolod 2007/03/05 17:23:07 UTC (20070305-3229) Log: - use a hashtable for fdlist storage. first step to making the amount of allowed clients dynamic and removing MAXCONNECTIONS. diff --git a/include/serno.h b/include/serno.h index 130e6f5..af92fcb 100644 --- a/include/serno.h +++ b/include/serno.h @@ -1 +1 @@ -#define SERNO "20070305-3229" +#define SERNO "20070305-3233" diff --git a/libcharybdis/commio.c b/libcharybdis/commio.c index c30322d..49cab12 100644 --- a/libcharybdis/commio.c +++ b/libcharybdis/commio.c @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: commio.c 3229 2007-03-05 17:23:07Z nenolod $ + * $Id: commio.c 3235 2007-03-05 17:31:35Z nenolod $ */ #include "libcharybdis.h" @@ -317,39 +317,51 @@ comm_setflush(int fd, time_t timeout, PF * callback, void *cbdata) void comm_checktimeouts(void *notused) { - int fd; PF *hdl; void *data; fde_t *F; - for (fd = 0; fd <= highest_fd; fd++) + dlink_list *bucket; + int i; + dlink_node *n, *n2; + + for (i = 0; i <= FD_HASH_SIZE; i) { - F = comm_locate_fd(fd); - if(F == NULL) - continue; - if(!F->flags.open) - continue; - if(F->flags.closing) + bucket = &fd_table[i]; + + if (dlink_list_length(bucket) <= 0) continue; - /* check flush functions */ - if(F->flush_handler && - F->flush_timeout > 0 && F->flush_timeout < CurrentTime) + DLINK_FOREACH_SAFE(n, n2, bucket->head) { - hdl = F->flush_handler; - data = F->flush_data; - comm_setflush(F->fd, 0, NULL, NULL); - hdl(F->fd, data); - } + F = (fde_t *) n->data; - /* check timeouts */ - if(F->timeout_handler && - F->timeout > 0 && F->timeout < CurrentTime) - { - /* Call timeout handler */ - hdl = F->timeout_handler; - data = F->timeout_data; - comm_settimeout(F->fd, 0, NULL, NULL); - hdl(F->fd, data); + if(F == NULL) + continue; + if(!F->flags.open) + continue; + if(F->flags.closing) + continue; + + /* check flush functions */ + if(F->flush_handler && + F->flush_timeout > 0 && F->flush_timeout < CurrentTime) + { + hdl = F->flush_handler; + data = F->flush_data; + comm_setflush(F->fd, 0, NULL, NULL); + hdl(F->fd, data); + } + + /* check timeouts */ + if(F->timeout_handler && + F->timeout > 0 && F->timeout < CurrentTime) + { + /* Call timeout handler */ + hdl = F->timeout_handler; + data = F->timeout_data; + comm_settimeout(F->fd, 0, NULL, NULL); + hdl(F->fd, data); + } } } }