mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-05 19:13:12 +02:00
Rewrite hash table code to use SipHash (more to follow)
This commit is contained in:
@@ -46,7 +46,7 @@ Cmode_t EXTMODE_HISTORY = 0L;
|
||||
*/
|
||||
#define HISTORY_SPREAD 16
|
||||
#define HISTORY_MAX_OFF_SECS 128
|
||||
#define HISTORY_CLEAN_PER_LOOP (CH_MAX/HISTORY_SPREAD)
|
||||
#define HISTORY_CLEAN_PER_LOOP (CHAN_HASH_TABLE_SIZE/HISTORY_SPREAD)
|
||||
#define HISTORY_TIMER_EVERY (HISTORY_MAX_OFF_SECS/HISTORY_SPREAD)
|
||||
|
||||
/* Forward declarations */
|
||||
@@ -538,7 +538,7 @@ EVENT(history_clean)
|
||||
}
|
||||
}
|
||||
hashnum++;
|
||||
if (hashnum >= CH_MAX)
|
||||
if (hashnum >= CHAN_HASH_TABLE_SIZE)
|
||||
hashnum = 0;
|
||||
} while(loopcnt++ < HISTORY_CLEAN_PER_LOOP);
|
||||
}
|
||||
|
||||
@@ -294,8 +294,8 @@ void _send_list(aClient *cptr)
|
||||
* and record that number as the number to start next time send_list
|
||||
* is called for this user. So, this function will almost always send
|
||||
* back more lines than specified by numsend (though not by much,
|
||||
* assuming CH_MAX is was well picked). So be conservative in your choice
|
||||
* of numsend. -Rak
|
||||
* assuming the hashing algorithm works well). Be conservative in your
|
||||
* choice of numsend. -Rak
|
||||
*/
|
||||
|
||||
/* Begin of /list? then send official channels. */
|
||||
@@ -315,7 +315,7 @@ void _send_list(aClient *cptr)
|
||||
}
|
||||
}
|
||||
|
||||
for (hashnum = lopt->starthash; hashnum < CH_MAX; hashnum++)
|
||||
for (hashnum = lopt->starthash; hashnum < CHAN_HASH_TABLE_SIZE; hashnum++)
|
||||
{
|
||||
if (numsend > 0)
|
||||
for (chptr = hash_get_chan_bucket(hashnum);
|
||||
@@ -394,7 +394,7 @@ void _send_list(aClient *cptr)
|
||||
}
|
||||
|
||||
/* All done */
|
||||
if (hashnum == CH_MAX)
|
||||
if (hashnum == CHAN_HASH_TABLE_SIZE)
|
||||
{
|
||||
sendnumeric(cptr, RPL_LISTEND);
|
||||
free_str_list(cptr->user->lopt->yeslist);
|
||||
|
||||
@@ -870,10 +870,11 @@ int stats_mem(aClient *sptr, char *para)
|
||||
|
||||
sendnumericfmt(sptr, RPL_STATSDEBUG,
|
||||
"Hash: client %d(%ld) chan %d(%ld) watch %d(%ld)",
|
||||
U_MAX,
|
||||
(long)(sizeof(aHashEntry) * U_MAX), CH_MAX,
|
||||
(long)(sizeof(aHashEntry) * CH_MAX), WATCHHASHSIZE,
|
||||
(long)(sizeof(aWatch *) * WATCHHASHSIZE));
|
||||
NICK_HASH_TABLE_SIZE,
|
||||
(long)(sizeof(aHashEntry) * NICK_HASH_TABLE_SIZE),
|
||||
CHAN_HASH_TABLE_SIZE,
|
||||
(long)(sizeof(aHashEntry) * CHAN_HASH_TABLE_SIZE), WATCH_HASH_TABLE_SIZE,
|
||||
(long)(sizeof(aWatch *) * WATCH_HASH_TABLE_SIZE));
|
||||
|
||||
for (link = freelink; link; link = link->next)
|
||||
fl++;
|
||||
@@ -886,9 +887,9 @@ int stats_mem(aClient *sptr, char *para)
|
||||
|
||||
tot = totww + totch + totcl + com + cl * sizeof(aClass) + db + rm;
|
||||
tot += fl * sizeof(Link);
|
||||
tot += sizeof(aHashEntry) * U_MAX;
|
||||
tot += sizeof(aHashEntry) * CH_MAX;
|
||||
tot += sizeof(aWatch *) * WATCHHASHSIZE;
|
||||
tot += sizeof(aHashEntry) * NICK_HASH_TABLE_SIZE;
|
||||
tot += sizeof(aHashEntry) * CHAN_HASH_TABLE_SIZE;
|
||||
tot += sizeof(aWatch *) * WATCH_HASH_TABLE_SIZE;
|
||||
|
||||
sendnumericfmt(sptr, RPL_STATSDEBUG, "Total: ww %ld ch %ld cl %ld co %ld db %ld",
|
||||
totww, totch, totcl, com, db);
|
||||
|
||||
@@ -53,9 +53,8 @@ MOD_UNLOAD(m_whowas)
|
||||
}
|
||||
|
||||
/* externally defined functions */
|
||||
extern unsigned int hash_whowas_name(char *);
|
||||
extern MODVAR aWhowas WHOWAS[NICKNAMEHISTORYLENGTH];
|
||||
extern MODVAR aWhowas *WHOWASHASH[WW_MAX];
|
||||
extern aWhowas MODVAR WHOWAS[NICKNAMEHISTORYLENGTH];
|
||||
extern aWhowas MODVAR *WHOWASHASH[WHOWAS_HASH_TABLE_SIZE];
|
||||
|
||||
/*
|
||||
** m_whowas
|
||||
|
||||
Reference in New Issue
Block a user