[svn] - rework comm_checktimeouts() to use the hashtable in an efficient manner.
This commit is contained in:
parent
c961476e55
commit
d0e1e8ee78
3 changed files with 48 additions and 27 deletions
|
@ -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)
|
nenolod 2007/03/05 17:23:07 UTC (20070305-3229)
|
||||||
Log:
|
Log:
|
||||||
- use a hashtable for fdlist storage. first step to making the amount of allowed clients dynamic and removing MAXCONNECTIONS.
|
- use a hashtable for fdlist storage. first step to making the amount of allowed clients dynamic and removing MAXCONNECTIONS.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define SERNO "20070305-3229"
|
#define SERNO "20070305-3233"
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA
|
* 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"
|
#include "libcharybdis.h"
|
||||||
|
@ -317,13 +317,24 @@ comm_setflush(int fd, time_t timeout, PF * callback, void *cbdata)
|
||||||
void
|
void
|
||||||
comm_checktimeouts(void *notused)
|
comm_checktimeouts(void *notused)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
PF *hdl;
|
PF *hdl;
|
||||||
void *data;
|
void *data;
|
||||||
fde_t *F;
|
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);
|
bucket = &fd_table[i];
|
||||||
|
|
||||||
|
if (dlink_list_length(bucket) <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
DLINK_FOREACH_SAFE(n, n2, bucket->head)
|
||||||
|
{
|
||||||
|
F = (fde_t *) n->data;
|
||||||
|
|
||||||
if(F == NULL)
|
if(F == NULL)
|
||||||
continue;
|
continue;
|
||||||
if(!F->flags.open)
|
if(!F->flags.open)
|
||||||
|
@ -352,6 +363,7 @@ comm_checktimeouts(void *notused)
|
||||||
hdl(F->fd, data);
|
hdl(F->fd, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue