diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-12 12:29:40 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-12 12:29:40 +0000 |
commit | b81c2e4c4eda2c7ae6fa5fbccfe40c94852fdf3b (patch) | |
tree | 0018baf9ca6ebbd0b54f406c60b563763a81ed98 | |
parent | 1582c2d1c54fedb39869d9632f77f848e62cd55e (diff) |
More experimental gubbins
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2330 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/socketengine.h | 9 | ||||
-rw-r--r-- | src/inspircd.cpp | 42 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 4 | ||||
-rw-r--r-- | src/socketengine.cpp | 3 |
4 files changed, 31 insertions, 27 deletions
diff --git a/include/socketengine.h b/include/socketengine.h index 116f61684..a499b4282 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -32,10 +32,11 @@ #include <sys/time.h> #endif -const char X_LISTEN = 0; -const char X_ESTAB_CLIENT = 1; -const char X_ESTAB_MODULE = 2; -const char X_ESTAB_DNS = 3; +const char X_EMPTY_SLOT = 0; +const char X_LISTEN = 1; +const char X_ESTAB_CLIENT = 2; +const char X_ESTAB_MODULE = 3; +const char X_ESTAB_DNS = 4; const char X_READBIT = 0x80; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 01cf4f392..76c091cac 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2560,22 +2560,6 @@ int InspIRCd(char** argv, int argc) log(DEBUG,"InspIRCd: startup: read %lu total client ports",(unsigned long)portCount); printf("\n"); - - /* BugFix By Craig! :p */ - MODCOUNT = -1; - for (count = 0; count < ConfValueEnum("module",&config_f); count++) - { - ConfValue("module","name",count,configToken,&config_f); - printf("Loading module... \033[1;32m%s\033[0m\n",configToken); - if (!LoadModule(configToken)) - { - log(DEFAULT,"Exiting due to a module loader error."); - printf("\nThere was an error loading a module: %s\n\nYou might want to do './inspircd start' instead of 'bin/inspircd'\n\n",ModuleError()); - Exit(0); - } - } - log(DEFAULT,"Total loaded modules: %lu",(unsigned long)MODCOUNT+1); - startup_time = time(NULL); char PID[MAXBUF]; @@ -2611,9 +2595,6 @@ int InspIRCd(char** argv, int argc) printf("\nERROR: Was not able to bind any of %lu ports! Please check your configuration.\n\n", (unsigned long)portCount); return (ERROR); } - - - printf("\nInspIRCd is now running!\n"); if (nofork) { @@ -2631,6 +2612,29 @@ int InspIRCd(char** argv, int argc) SE = new SocketEngine(); + /* We must load the modules AFTER initializing the socket engine, now */ + MODCOUNT = -1; + for (count = 0; count < ConfValueEnum("module",&config_f); count++) + { + ConfValue("module","name",count,configToken,&config_f); + printf("Loading module... \033[1;32m%s\033[0m\n",configToken); + if (!LoadModule(configToken)) + { + log(DEFAULT,"Exiting due to a module loader error."); + printf("\nThere was an error loading a module: %s\n\nYou might want to do './inspircd start' instead of 'bin/inspircd'\n\n",ModuleError()); + Exit(0); + } + } + log(DEFAULT,"Total loaded modules: %lu",(unsigned long)MODCOUNT+1); + + printf("\nInspIRCd is now running!\n"); + + if (!nofork) + { + freopen("/dev/null","w",stdout); + freopen("/dev/null","w",stderr); + } + /* Add the listening sockets used for client inbound connections * to the socket engine */ diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 4a83abc22..e601ae496 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -107,9 +107,7 @@ int DaemonSeed (void) setsid (); umask (007); printf("InspIRCd Process ID: \033[1;32m%lu\033[0m\n",(unsigned long)getpid()); - freopen("/dev/null","w",stdout); - freopen("/dev/null","w",stderr); - + setpriority(PRIO_PROCESS,(int)getpid(),15); if (unlimitcore) diff --git a/src/socketengine.cpp b/src/socketengine.cpp index e00657a54..23088edb9 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -41,12 +41,13 @@ SocketEngine::~SocketEngine() char SocketEngine::GetType(int fd) { /* Mask off the top bit used for 'read/write' state */ - return (ref[fd] & 0x7F); + return (ref[fd] & ~0x80); } bool SocketEngine::AddFd(int fd, bool readable, char type) { this->fds.push_back(fd); + ref[fd] = type; if (readable) ref[fd] |= X_READBIT; #ifdef USE_EPOLL |