diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-01 13:49:25 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-01 13:49:25 +0000 |
commit | ce8c0f1d6b42f2bdccc81ab5d939100bae4b1133 (patch) | |
tree | 94e39f452e21275edf28cc49f4224d26eaba6d36 | |
parent | f5bd3291ed24915d50718473d830b3c363def711 (diff) |
- dbs are now periodically flushed on disc every 5 minutes
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1625 82007160-df01-0410-b94d-b575c5fd34c7
-rw-r--r-- | include/conf_db.h | 5 | ||||
-rw-r--r-- | modules/m_dline.c | 2 | ||||
-rw-r--r-- | modules/m_gline.c | 2 | ||||
-rw-r--r-- | modules/m_kline.c | 2 | ||||
-rw-r--r-- | modules/m_xline.c | 2 | ||||
-rw-r--r-- | src/conf_db.c | 10 | ||||
-rw-r--r-- | src/ircd.c | 2 | ||||
-rw-r--r-- | src/resv.c | 6 |
8 files changed, 14 insertions, 17 deletions
diff --git a/include/conf_db.h b/include/conf_db.h index c5dd1b2..82321d2 100644 --- a/include/conf_db.h +++ b/include/conf_db.h @@ -74,7 +74,7 @@ extern void load_xline_database(void); extern void save_xline_database(void); extern void load_resv_database(void); extern void save_resv_database(void); - +extern void save_all_databases(void *); #define read_buffer(buf,f) (read_db((f),(buf),sizeof(buf)) == sizeof(buf)) #define write_buffer(buf,f) (write_db((f),(buf),sizeof(buf)) == sizeof(buf)) @@ -83,7 +83,6 @@ extern void save_resv_database(void); #define read_variable(var,f) (read_db((f),&(var),sizeof(var)) == sizeof(var)) #define write_variable(var,f) (write_db((f),&(var),sizeof(var)) == sizeof(var)) +#define DATABASE_UPDATE_TIMEOUT 300 #define KLINE_DB_VERSION 1 - - #endif diff --git a/modules/m_dline.c b/modules/m_dline.c index b17a6fc..a4396e9 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -83,7 +83,6 @@ apply_dline(struct Client *source_p, struct AccessItem *aconf, aconf->setat = CurrentTime; add_conf_by_address(CONF_DLINE, aconf); - save_dline_database(); rehashed_klines = 1; } @@ -120,7 +119,6 @@ remove_dline_match(const char *host) if (!IsConfMain(aconf)) { delete_one_address_conf(host, aconf); - save_dline_database(); return 1; } } diff --git a/modules/m_gline.c b/modules/m_gline.c index 8f8835b..b748bec 100644 --- a/modules/m_gline.c +++ b/modules/m_gline.c @@ -81,7 +81,6 @@ set_local_gline(const struct Client *source_p, const char *user, get_oper_name(source_p), aconf->user, aconf->host, aconf->reason); add_conf_by_address(CONF_GLINE, aconf); - save_gline_database(); rehashed_klines = 1; } @@ -116,7 +115,6 @@ remove_gline_match(const char *user, const char *host) if ((aconf = find_conf_by_address(host, piphost, CONF_GLINE, t, user, NULL, 0))) { delete_one_address_conf(host, aconf); - save_gline_database(); return 1; } diff --git a/modules/m_kline.c b/modules/m_kline.c index 315c5e8..78c790a 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.c @@ -257,7 +257,6 @@ m_kline_add_kline(struct Client *source_p, struct AccessItem *aconf, } add_conf_by_address(CONF_KLINE, aconf); - save_kline_database(); rehashed_klines = 1; } @@ -472,7 +471,6 @@ remove_kline_match(const char *host, const char *user) if (!IsConfMain(aconf)) { delete_one_address_conf(host, aconf); - save_kline_database(); return 1; } } diff --git a/modules/m_xline.c b/modules/m_xline.c index c0413a7..c97215d 100644 --- a/modules/m_xline.c +++ b/modules/m_xline.c @@ -375,7 +375,6 @@ write_xline(struct Client *source_p, char *gecos, char *reason, get_oper_name(source_p), conf->name, xconf->reason); } - save_xline_database(); rehashed_klines = 1; } @@ -392,7 +391,6 @@ remove_xline(struct Client *source_p, char *gecos) get_oper_name(source_p), gecos); ilog(LOG_TYPE_KLINE, "%s removed X-Line for [%s]", source_p->name, gecos); - save_xline_database(); } else sendto_one(source_p, ":%s NOTICE %s :No X-Line for %s", diff --git a/src/conf_db.c b/src/conf_db.c index a888b56..115b1d5 100644 --- a/src/conf_db.c +++ b/src/conf_db.c @@ -1073,3 +1073,13 @@ load_xline_database(void) close_db(f); } + +void +save_all_databases(void *unused) +{ + save_kline_database(); + save_dline_database(); + save_gline_database(); + save_xline_database(); + save_resv_database(); +} @@ -651,6 +651,8 @@ main(int argc, char *argv[]) /* Setup the timeout check. I'll shift it later :) -- adrian */ eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1); + eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT); + if (ConfigServerHide.links_delay > 0) eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay); else @@ -73,9 +73,6 @@ create_channel_resv(char *name, char *reason, int in_conf) dlinkAdd(resv_p, &resv_p->node, &resv_channel_list); hash_add_resv(resv_p); - if (!in_conf) - save_resv_database(); - return conf; } @@ -109,9 +106,6 @@ create_nick_resv(char *name, char *reason, int in_conf) DupString(resv_p->reason, reason); resv_p->action = in_conf; - if (!in_conf) - save_resv_database(); - return conf; } |