diff options
| author | 2006-08-08 09:32:57 +0000 | |
|---|---|---|
| committer | 2006-08-08 09:32:57 +0000 | |
| commit | 2329d59b09cdc05b0b403f7d313df65492e1813b (patch) | |
| tree | 6d5f005565b62883e09ed2b2e09752fc034da413 /src/inspircd.cpp | |
| parent | Only local users can have angry monkeys and packs of wild dogs. These are loc... (diff) | |
Extra checking that the fd's we pass to SocketEngine::AddFd were added (a lot of assuming was going off, leading to total chaos if we run out of fd's etc)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4780 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
| -rw-r--r-- | src/inspircd.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index c31dbae50..27029a6e4 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -908,7 +908,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets) int InspIRCd::Run() { /* Until THIS point, ServerInstance == NULL */ - + this->Res = new DNS(); LoadAllModules(this); @@ -916,21 +916,12 @@ int InspIRCd::Run() /* Just in case no modules were loaded - fix for bug #101 */ this->BuildISupport(); - printf("\nInspIRCd is now running!\n"); - if (!stats->BoundPortCount) { printf("\nI couldn't bind any ports! Are you sure you didn't start InspIRCd twice?\n"); Exit(ERROR); } - if (!Config->nofork) - { - fclose(stdout); - fclose(stderr); - fclose(stdin); - } - /* Add the listening sockets used for client inbound connections * to the socket engine */ @@ -938,9 +929,22 @@ int InspIRCd::Run() for (unsigned long count = 0; count < stats->BoundPortCount; count++) { log(DEBUG,"Add listener: %d",Config->openSockfd[count]); - SE->AddFd(Config->openSockfd[count],true,X_LISTEN); + if (!SE->AddFd(Config->openSockfd[count],true,X_LISTEN)) + { + printf("\nEH? Could not add listener to socketengine. You screwed up, aborting.\n"); + Exit(ERROR); + } } + if (!Config->nofork) + { + fclose(stdout); + fclose(stderr); + fclose(stdin); + } + + printf("\nInspIRCd is now running!\n"); + this->WritePID(Config->PID); /* main loop, this never returns */ |
