summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-12 12:29:40 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-12 12:29:40 +0000
commitb81c2e4c4eda2c7ae6fa5fbccfe40c94852fdf3b (patch)
tree0018baf9ca6ebbd0b54f406c60b563763a81ed98 /src
parent1582c2d1c54fedb39869d9632f77f848e62cd55e (diff)
More experimental gubbins
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2330 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp42
-rw-r--r--src/inspircd_io.cpp4
-rw-r--r--src/socketengine.cpp3
3 files changed, 26 insertions, 23 deletions
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