diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-08 13:44:30 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-08 13:44:30 +0000 |
commit | b4a59f316ee9d85156fbd1e289000b1ed23b2331 (patch) | |
tree | 372f3a5c3a277050fced13c6919fe1000b9b07f6 /src | |
parent | 4615a491534bb0b4088e3aafd0a1b3b3b2fffcd7 (diff) |
Fixes to connection pooling... this brain misunderstood the parameters to select :p
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@452 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/InspIRCd.dev | 52 | ||||
-rw-r--r-- | src/InspIRCd.layout | 78 | ||||
-rw-r--r-- | src/inspircd.cpp | 110 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 3 | ||||
-rw-r--r-- | src/modules.cpp | 2 |
5 files changed, 128 insertions, 117 deletions
diff --git a/src/InspIRCd.dev b/src/InspIRCd.dev index c30d4d51e..310e88ccb 100644 --- a/src/InspIRCd.dev +++ b/src/InspIRCd.dev @@ -1,7 +1,7 @@ [Project] FileName=InspIRCd.dev -Name=InspIRCd -UnitCount=40 +Name=InspIRCd - The Inspire Internet Relay Chat Daemon +UnitCount=38 Type=1 Ver=1 ObjFiles= @@ -19,7 +19,7 @@ ObjectOutput= OverrideOutput=0 OverrideOutputName=InspIRCd.exe HostApplication= -Folders=Headers,Modules,"Shell Scripts etc",Source +Folders=Headers,Modules,Source CommandLine= IncludeVersionInfo=0 SupportXPThemes=0 @@ -365,26 +365,8 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit33] -FileName=..\makeconf -Folder=Shell Scripts etc -Compile=0 -Link=0 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit34] -FileName=..\configure -Folder=Shell Scripts etc -Compile=0 -Link=0 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit35] -FileName=modules\m_filter.cpp +FileName=modules\m_sethost.cpp CompileCpp=1 Folder=Modules Compile=1 @@ -394,7 +376,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit36] -FileName=modules\m_chghost.cpp +FileName=modules\m_setname.cpp CompileCpp=1 Folder=Modules Compile=1 @@ -404,7 +386,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit37] -FileName=modules\m_sethost.cpp +FileName=modules\m_saquit.cpp CompileCpp=1 Folder=Modules Compile=1 @@ -414,7 +396,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit38] -FileName=modules\m_setname.cpp +FileName=modules\m_helpop.cpp CompileCpp=1 Folder=Modules Compile=1 @@ -443,3 +425,23 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit33] +FileName=modules\m_filter.cpp +CompileCpp=1 +Folder=Modules +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[Unit34] +FileName=modules\m_chghost.cpp +CompileCpp=1 +Folder=Modules +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 270bb296a..7cf802964 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,29 +1,29 @@ [Editors] Focused=1 -Order=7,3,2,6,25,24,4,5,-1,1,0 +Order=7,3,2,6,25,24,4,5,1,0,-1 [Editor_0] Open=1 Top=0 -CursorCol=18 -CursorRow=48 +CursorCol=20 +CursorRow=57 TopLine=26 LeftChar=1 [Editor_1] Open=1 Top=1 -CursorCol=26 -CursorRow=5558 -TopLine=5522 +CursorCol=19 +CursorRow=5504 +TopLine=5465 LeftChar=1 [Editor_2] Open=1 Top=0 -CursorCol=5 -CursorRow=113 -TopLine=101 +CursorCol=42 +CursorRow=225 +TopLine=184 LeftChar=1 [Editor_3] @@ -37,9 +37,9 @@ LeftChar=1 [Editor_4] Open=1 Top=0 -CursorCol=67 -CursorRow=321 -TopLine=317 +CursorCol=1 +CursorRow=119 +TopLine=113 LeftChar=1 [Editor_5] @@ -67,7 +67,7 @@ TopLine=6 LeftChar=1 [Editor_8] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=33 @@ -75,7 +75,7 @@ TopLine=1 LeftChar=1 [Editor_9] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -87,7 +87,7 @@ Open=1 Top=0 CursorCol=31 CursorRow=75 -TopLine=7 +TopLine=37 LeftChar=1 [Editor_11] @@ -107,7 +107,7 @@ TopLine=64 LeftChar=1 [Editor_13] -Open=1 +Open=0 Top=0 CursorCol=12 CursorRow=32 @@ -123,7 +123,7 @@ TopLine=1 LeftChar=1 [Editor_15] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=81 @@ -131,7 +131,7 @@ TopLine=50 LeftChar=1 [Editor_16] -Open=1 +Open=0 Top=0 CursorCol=34 CursorRow=29 @@ -139,7 +139,7 @@ TopLine=1 LeftChar=1 [Editor_17] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=115 @@ -147,7 +147,7 @@ TopLine=51 LeftChar=1 [Editor_18] -Open=1 +Open=0 Top=0 CursorCol=5 CursorRow=22 @@ -155,7 +155,7 @@ TopLine=1 LeftChar=1 [Editor_19] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -163,7 +163,7 @@ TopLine=1 LeftChar=1 [Editor_20] -Open=1 +Open=0 Top=0 CursorCol=6 CursorRow=553 @@ -171,7 +171,7 @@ TopLine=514 LeftChar=1 [Editor_21] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=25 @@ -179,7 +179,7 @@ TopLine=1 LeftChar=1 [Editor_22] -Open=1 +Open=0 Top=0 CursorCol=24 CursorRow=116 @@ -187,7 +187,7 @@ TopLine=59 LeftChar=1 [Editor_23] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=1 @@ -209,42 +209,42 @@ CursorRow=10 TopLine=1 LeftChar=1 [Editor_26] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=13 TopLine=23 LeftChar=1 [Editor_27] -Open=1 +Open=0 Top=0 CursorCol=6 CursorRow=34 TopLine=1 LeftChar=1 [Editor_28] -Open=1 +Open=0 Top=0 CursorCol=87 CursorRow=20 TopLine=5 LeftChar=1 [Editor_29] -Open=1 +Open=0 Top=0 CursorCol=49 CursorRow=9 TopLine=1 LeftChar=1 [Editor_30] -Open=1 +Open=0 Top=0 CursorCol=87 CursorRow=21 TopLine=1 LeftChar=4 [Editor_31] -Open=1 +Open=0 Top=0 CursorCol=32 CursorRow=33 @@ -253,46 +253,50 @@ LeftChar=1 [Editor_32] Open=0 Top=0 +CursorCol=1 +CursorRow=1 +TopLine=1 +LeftChar=1 [Editor_33] Open=0 Top=0 [Editor_34] -Open=1 +Open=0 Top=0 CursorCol=26 CursorRow=155 TopLine=113 LeftChar=1 [Editor_35] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=25 TopLine=1 LeftChar=1 [Editor_36] -Open=1 +Open=0 Top=0 CursorCol=1 CursorRow=34 TopLine=1 LeftChar=1 [Editor_37] -Open=1 +Open=0 Top=0 CursorCol=37 CursorRow=29 TopLine=1 LeftChar=1 [Editor_38] -Open=1 +Open=0 Top=0 CursorCol=49 CursorRow=31 TopLine=1 LeftChar=1 [Editor_39] -Open=1 +Open=0 Top=0 CursorCol=20 CursorRow=84 diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 1f3a24332..c5fa963c3 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -5399,28 +5399,9 @@ int InspIRCd(void) int flip_flop = 0, udp_port = 0; char udp_msg[MAXBUF], udp_host[MAXBUF]; - /* main loop for multiplexing/resetting */ + /* main loop, this never returns */ for (;;) { - /* set up select call */ - for (count = 0; count < boundPortCount; count++) - { - FD_SET (openSockfd[count], &selectFds); - } - - /* added timeout! select was waiting forever... wank... :/ */ - tv.tv_usec = 0; - - flip_flop++; - reap_counter++; - if (flip_flop > 20) - { - tv.tv_usec = 1; - flip_flop = 0; - } - - vector<int>::iterator niterator; - // *FIX* Instead of closing sockets in kill_link when they receive the ERROR :blah line, we should queue // them in a list, then reap the list every second or so. @@ -5437,10 +5418,7 @@ int InspIRCd(void) reap_counter=0; } - - tv.tv_sec = 0; - selectResult = select(MAXSOCKS, &selectFds, NULL, NULL, &tv); - + for (int x = 0; x != UDPportCount; x++) { long theirkey = 0; @@ -5460,6 +5438,7 @@ int InspIRCd(void) fd_set sfd; struct timeval tval; + FD_ZERO(&sfd); user_hash::iterator count2 = clientlist.begin(); @@ -5487,41 +5466,43 @@ int InspIRCd(void) { if (count2 != clientlist.end()) { - // registration timeout -- didnt send USER/NICK/HOST in the time specified in - // their connection class. - if ((time(NULL) > count2->second->timeout) && (count2->second->registered != 7)) - { - log(DEBUG,"InspIRCd: registration timeout: %s",count2->second->nick); - kill_link(count2->second,"Registration timeout"); - goto label; - } - if (((time(NULL)) > count2->second->nping) && (isnick(count2->second->nick)) && (count2->second->registered == 7)) - { - if (!count2->second->lastping) + FD_SET (count2->second->fd, &sfd); + + // registration timeout -- didnt send USER/NICK/HOST in the time specified in + // their connection class. + if ((time(NULL) > count2->second->timeout) && (count2->second->registered != 7)) { - log(DEBUG,"InspIRCd: ping timeout: %s",count2->second->nick); - kill_link(count2->second,"Ping timeout"); + log(DEBUG,"InspIRCd: registration timeout: %s",count2->second->nick); + kill_link(count2->second,"Registration timeout"); goto label; } - Write(count2->second->fd,"PING :%s",ServerName); - log(DEBUG,"InspIRCd: pinging: %s",count2->second->nick); - count2->second->lastping = 0; - count2->second->nping = time(NULL)+120; - } - - FD_SET (count2->second->fd, &sfd); - count2++; - total_in_this_set++; + if (((time(NULL)) > count2->second->nping) && (isnick(count2->second->nick)) && (count2->second->registered == 7)) + { + if ((!count2->second->lastping) && (count2->second->registered == 7)) + { + log(DEBUG,"InspIRCd: ping timeout: %s",count2->second->nick); + kill_link(count2->second,"Ping timeout"); + goto label; + } + Write(count2->second->fd,"PING :%s",ServerName); + log(DEBUG,"InspIRCd: pinging: %s",count2->second->nick); + count2->second->lastping = 0; + count2->second->nping = time(NULL)+120; + } + count2++; + total_in_this_set++; } else break; } - endingiter = count2; + endingiter = count2; count2 = xcount; // roll back to where we were - + + int v = 0; + tval.tv_usec = 0; tval.tv_sec = 0; - selectResult2 = select(total_in_this_set, &sfd, NULL, NULL, &tval); + selectResult2 = select(65535, &sfd, NULL, NULL, &tval); // now loop through all of the items in this pool if any are waiting //if (selectResult2 > 0) @@ -5533,6 +5514,7 @@ int InspIRCd(void) result = read(count2a->second->fd, data, 1); if ((result == -1) && (errno != EAGAIN) && (errno != EINTR)) { + log(DEBUG,"killing: %s",count2a->second->nick); kill_link(count2a->second,strerror(errno)); goto label; } @@ -5606,6 +5588,26 @@ int InspIRCd(void) } } + // set up select call + for (count = 0; count < boundPortCount; count++) + { + FD_SET (openSockfd[count], &selectFds); + } + + /* added timeout! select was waiting forever... wank... :/ */ + tv.tv_usec = 0; + + flip_flop++; + reap_counter++; + if (flip_flop > 20) + { + tv.tv_usec = 1; + flip_flop = 0; + } + + tv.tv_sec = 0; + selectResult = select(MAXSOCKS, &selectFds, NULL, NULL, &tv); + /* select is reporting a waiting socket. Poll them all to find out which */ if (selectResult > 0) { @@ -5641,11 +5643,13 @@ int InspIRCd(void) { WriteOpers("*** WARNING: Accept failed on port %d (%s)", ports[count],target); log(DEBUG,"InspIRCd: accept failed: %d",ports[count]); - break; } - AddClient(incomingSockfd, resolved, ports[count], iscached); - log(DEBUG,"InspIRCd: adding client on port %d fd=%d",ports[count],incomingSockfd); - break; + else + { + AddClient(incomingSockfd, resolved, ports[count], iscached); + log(DEBUG,"InspIRCd: adding client on port %d fd=%d",ports[count],incomingSockfd); + } + goto label; } } } diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index bb78c2c4b..f1f11d265 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -224,7 +224,7 @@ int EnumConf(std::stringstream *config, const char* tag) int ConfValueEnum(char* tag, std::stringstream* config) { - EnumConf(config,tag); + return EnumConf(config,tag); } @@ -347,6 +347,7 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in int ConfValue(char* tag, char* var, int index, char *result,std::stringstream *config) { ReadConf(config, tag, var, index, result); + return 0; } diff --git a/src/modules.cpp b/src/modules.cpp index 37a0e742e..bbea0d412 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -116,7 +116,7 @@ void Module::OnPacketReceive(char *p) { } void Module::OnRehash() { } void Module::OnServerRaw(std::string &raw, bool inbound) { } int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; } -bool Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) { } +bool Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) { return false; } Version Module::GetVersion() { return Version(1,0,0,0); } void Module::OnOper(userrec* user) { }; void Module::OnInfo(userrec* user) { }; |