*/
# negcache = 1 hour;
+ /*
+ * How long between rebuilds of the negative cache. The negcache
+ * is only rebuilt to free up memory used by entries that are too old.
+ * You probably don't need to tweak this unless you have huge amounts
+ * of people connecting (hundreds per minute). Default is 12 hours.
+ */
+ negcache_rebuild = 12 hours;
+
/*
* Amount of file descriptors to allocate to asynchronous DNS. 64
* should be plenty for almost anyone.
MODE { return MODE; }
NAME { return NAME; }
NEGCACHE { return NEGCACHE; }
+NEGCACHE_REBUILD { return NEGCACHE_REBUILD; }
NICK { return NICK; }
NICKSERV { return NICKSERV; }
OPER { return OPER; }
%token MODE
%token NAME
%token NEGCACHE
+%token NEGCACHE_REBUILD
%token NICK
%token NICKSERV
%token OPER
options_item;
options_item: options_negcache |
+ options_negcache_rebuild |
options_pidfile |
options_dns_fdlimit |
options_scanlog |
OptionsItem->negcache = $3;
};
+options_negcache_rebuild: NEGCACHE_REBUILD '=' timespec ';'
+{
+ OptionsItem->negcache_rebuild = $3;
+};
+
options_pidfile: PIDFILE '=' STRING ';'
{
MyFree(OptionsItem->pidfile);
/* Setup options block defaults */
OptionsItem->negcache = 0; /* 0 disabled negcache */
+ OptionsItem->negcache_rebuild = 43200;
OptionsItem->pidfile = xstrdup("hopm.pid");
OptionsItem->dns_fdlimit = 50;
OptionsItem->scanlog = NULL;
struct OptionsConf
{
int negcache;
+ time_t negcache_rebuild;
unsigned int dns_fdlimit;
char *pidfile;
char *scanlog;
/* Interval in how often we try to reconnect (in seconds) */
#define RECONNECTINTERVAL 30
-
-/* How long (in seconds) between rebuilds of the negative cache. The negcache
- * is only rebuilt to free up memory used by entries that are too old. You
- * probably don't need to tweak this unless you have huge amounts of people
- * connecting (hundreds per minute). Default is 12 hours.
- */
-#define NEG_CACHE_REBUILD (60 * 60 * 12)
#endif /* OPTIONS_H */
void
scan_timer(void)
{
- static unsigned int nc_counter;
+ static time_t nc_counter;
if (OptionsItem->negcache > 0)
{
- if (nc_counter++ >= NEG_CACHE_REBUILD)
+ if (nc_counter++ >= OptionsItem->negcache_rebuild)
{
/*
- * Time to rebuild the negative
- * cache.
+ * Time to rebuild the negative cache.
*/
if (OPT_DEBUG)
log_printf("SCAN -> Rebuilding negative cache");