]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Fix --with-max-clients not taking a parameter (reported by erich)
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 5cfb55ab186ff9a2bb68c950f6d5dca205b58bc6..d5146e900edd7e1af648820a57dfa4298fa9731b 100644 (file)
@@ -139,6 +139,7 @@ void InspIRCd::Rehash(int status)
        SI->CloseLog();
        SI->OpenLog(NULL,0);
        SI->RehashUsersAndChans();
+       FOREACH_MOD_I(SI, I_OnGarbageCollect, OnGarbageCollect());
        SI->Config->Read(false,NULL);
        FOREACH_MOD_I(SI,I_OnRehash,OnRehash(""));
 }
@@ -266,6 +267,10 @@ InspIRCd::InspIRCd(int argc, char** argv)
        this->chanlist = new chan_hash();
 
        this->Config = new ServerConfig(this);
+
+       this->Config->argv = argv;
+       this->Config->argc = argc;
+
        this->Config->opertypes.clear();
        this->Config->operclass.clear();
        this->SNO = new SnomaskManager(this);
@@ -810,6 +815,8 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
                if ((TIME % 3600) == 0)
                {
                        irc::whowas::MaintainWhoWas(this, TIME);
+                       this->RehashUsersAndChans();
+                       FOREACH_MOD_I(this, I_OnGarbageCollect, OnGarbageCollect());
                }
                Timers->TickTimers(TIME);
                this->DoBackgroundUserStuff(TIME);
@@ -955,7 +962,8 @@ bool FileLogger::Readable()
 void FileLogger::HandleEvent(EventType et, int errornum)
 {
        this->WriteLogLine("");
-       ServerInstance->SE->DelFd(this);
+       if (log)
+               ServerInstance->SE->DelFd(this);
 }
 
 void FileLogger::WriteLogLine(const std::string &line)
@@ -996,18 +1004,24 @@ void FileLogger::Close()
                fcntl(fileno(log), F_SETFL, flags ^ O_NONBLOCK);
                if (buffer.size())
                        fprintf(log,"%s",buffer.c_str());
+
+               ServerInstance->SE->DelFd(this);
+
                fflush(log);
                fclose(log);
        }
+
        buffer = "";
-       ServerInstance->SE->DelFd(this);
 }
 
 FileLogger::FileLogger(InspIRCd* Instance, FILE* logfile) : ServerInstance(Instance), log(logfile), writeops(0)
 {
-       irc::sockets::NonBlocking(fileno(log));
-       this->SetFd(fileno(log));
-       buffer = "";
+       if (log)
+       {
+               irc::sockets::NonBlocking(fileno(log));
+               this->SetFd(fileno(log));
+               buffer = "";
+       }
 }
 
 FileLogger::~FileLogger()