Rewrite znc.conf on SIGUSR1

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1666 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-11-20 15:38:21 +00:00
parent a8a7525dfd
commit c1ee724829
3 changed files with 40 additions and 10 deletions
+16 -3
View File
@@ -41,7 +41,7 @@ CZNC::CZNC() {
m_uBytesRead = 0;
m_uBytesWritten = 0;
m_pConnectUserTimer = NULL;
m_bNeedRehash = false;
m_eConfigState = ECONFIG_NOTHING;
m_TimeStarted = time(NULL);
}
@@ -228,8 +228,9 @@ void CZNC::Loop() {
while (true) {
CString sError;
if (GetNeedRehash()) {
SetNeedRehash(false);
switch (GetConfigState()) {
case ECONFIG_NEED_REHASH:
SetConfigState(ECONFIG_NOTHING);
if (RehashConfig(sError)) {
Broadcast("Rehashing succeeded", true);
@@ -237,6 +238,18 @@ void CZNC::Loop() {
Broadcast("Rehashing failed: " + sError, true);
Broadcast("ZNC is in some possibly inconsistent state!", true);
}
break;
case ECONFIG_NEED_WRITE:
SetConfigState(ECONFIG_NOTHING);
if (WriteConfig()) {
Broadcast("Writing the config suceeded", true);
} else {
Broadcast("Writing the config file failed", true);
}
break;
case ECONFIG_NOTHING:
break;
}
// Check for users that need to be deleted