]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
*** empty log message ***
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 5759d1f78830ae99018f250e335742972145b337..4e6e0f86c9631b2519aef412e9c3556d5c345933 100644 (file)
@@ -1081,6 +1081,8 @@ void kill_link(userrec *user,const char* r)
                NetSendToAll(buffer);
        }
 
+       user->FlushWriteBuf();
+
        FOREACH_MOD OnUserDisconnect(user);
 
        if (user->fd > -1)
@@ -1108,15 +1110,14 @@ void kill_link(userrec *user,const char* r)
                 shutdown(user->fd,2);
                 close(user->fd);
        }
-       
-       if (user->registered == 7) {
-               WriteOpers("*** Client exiting: %s!%s@%s [%s]",user->nick,user->ident,user->host,reason);
-               AddWhoWas(user);
-       }
 
+       // this must come before the WriteOpers so that it doesnt try to fill their buffer with anything
+       // if they were an oper with +s.
         if (user->registered == 7) {
                 purge_empty_chans(user);
-        }
+               WriteOpers("*** Client exiting: %s!%s@%s [%s]",user->nick,user->ident,user->host,reason);
+               AddWhoWas(user);
+       }
 
        if (iter != clientlist.end())
        {
@@ -1145,6 +1146,8 @@ void kill_link_silent(userrec *user,const char* r)
        Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason);
        log(DEBUG,"closing fd %lu",(unsigned long)user->fd);
 
+       user->FlushWriteBuf();
+
        if (user->registered == 7) {
                FOREACH_MOD OnUserQuit(user);
                WriteCommonExcept(user,"QUIT :%s",reason);
@@ -2437,17 +2440,25 @@ bool UnloadModule(const char* filename)
 bool LoadModule(const char* filename)
 {
        char modfile[MAXBUF];
+#ifdef STATIC_LINK
+       snprintf(modfile,MAXBUF,"%s",filename);
+#else
        snprintf(modfile,MAXBUF,"%s/%s",ModPath,filename);
+#endif
        std::string filename_str = filename;
+#ifndef STATIC_LINK
        if (!DirValid(modfile))
        {
                log(DEFAULT,"Module %s is not within the modules directory.",modfile);
                snprintf(MODERR,MAXBUF,"Module %s is not within the modules directory.",modfile);
                return false;
        }
+#endif
        log(DEBUG,"Loading module: %s",modfile);
+#ifndef STATIC_LINK
         if (FileExists(modfile))
         {
+#endif
                for (int j = 0; j < module_names.size(); j++)
                {
                        if (module_names[j] == filename_str)
@@ -2480,6 +2491,7 @@ bool LoadModule(const char* filename)
                        snprintf(MODERR,MAXBUF,"Factory function failed!");
                        return false;
                 }
+#ifndef STATIC_LINK
         }
         else
         {
@@ -2487,6 +2499,7 @@ bool LoadModule(const char* filename)
                snprintf(MODERR,MAXBUF,"Module file could not be found");
                return false;
         }
+#endif
        MODCOUNT++;
        return true;
 }
@@ -2833,11 +2846,7 @@ int InspIRCd(char** argv, int argc)
                }
                tvs.tv_usec = 30000L;
                tvs.tv_sec = 0;
-#ifdef IS_SOLARIS
-               int servresult = select(1024, &serverfds, NULL, NULL, &tvs);
-#else
-               int servresult = select(32767, &serverfds, NULL, NULL, &tvs);
-#endif
+               int servresult = select(FD_SETSIZE, &serverfds, NULL, NULL, &tvs);
                if (servresult > 0)
                {
                        for (int x = 0; x != SERVERportCount; x++)
@@ -3097,20 +3106,10 @@ int InspIRCd(char** argv, int argc)
 #ifdef USE_SELECT
                        tval.tv_sec = 0;
                        tval.tv_usec = 1000L;
-#ifdef IS_SOLARIS
-                       selectResult2 = select(1024, &sfd, NULL, NULL, &tval);
-#else
-                       selectResult2 = select(65535, &sfd, NULL, NULL, &tval);
-#endif
-                       
+                       selectResult2 = select(FD_SETSIZE, &sfd, NULL, NULL, &tval);
                        // now loop through all of the items in this pool if any are waiting
                        if ((selectResult2 > 0) && (xcount != clientlist.end()))
-#ifdef IS_SOLARIS
-                       // on solaris, we cycle the entire list. Something is b0rked about referencing it by count2a.
-                       for (user_hash::iterator count2a = clientlist.begin(); count2a != clientlist.end(); count2a++)
-#else
                        for (user_hash::iterator count2a = xcount; count2a != endingiter; count2a++)
-#endif
                        {
                                // SELECT: we have to iterate...
                                if (count2a == clientlist.end())
@@ -3255,10 +3254,7 @@ int InspIRCd(char** argv, int argc)
 
                                                        }
                                                }
-#ifndef IS_SOLARIS
-                                               if ((currfd < 0) || (!fd_ref_table[currfd]))
-#endif
-                                                       goto label;
+                                               goto label;
                                        }
 
                                        if ((result == -1) && (errno != EAGAIN) && (errno != EINTR))