summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-27 11:50:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-27 11:50:16 +0000
commit978e8de69f1f5303bf9d9b24f764d890d73c927f (patch)
tree1c584849a6d4d0a77911f1cbd3fda68a01f361e8
parenteb04595b0b184f0593ca85af04f4f074cd2f69d2 (diff)
Optimized stuff
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1212 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/commands.cpp2
-rw-r--r--src/inspircd.cpp29
-rw-r--r--src/modules.cpp15
-rw-r--r--src/wildcard.cpp8
4 files changed, 28 insertions, 26 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index f1614b772..8d1436f7a 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -940,6 +940,7 @@ void handle_quit(char **parameters, int pcnt, userrec *user)
if (user->registered == 7) {
purge_empty_chans(user);
}
+ delete user;
}
void handle_who(char **parameters, int pcnt, userrec *user)
@@ -2055,6 +2056,7 @@ void handle_Q(char token,char* params,serverrec* source,serverrec* reply, char*
{
purge_empty_chans(user);
}
+ delete user;
}
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 4fa04e3c0..c773ddc4d 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2095,6 +2095,7 @@ void kill_link(userrec *user,const char* r)
if (user->registered == 7) {
purge_empty_chans(user);
}
+ delete user;
//user = NULL;
}
@@ -2146,6 +2147,7 @@ void kill_link_silent(userrec *user,const char* r)
if (user->registered == 7) {
purge_empty_chans(user);
}
+ delete user;
}
@@ -3801,14 +3803,14 @@ int InspIRCd(void)
fd_set serverfds;
timeval tvs;
- tvs.tv_usec = 7000L;
+ tvs.tv_usec = 10000L;
tvs.tv_sec = 0;
tv.tv_sec = 0;
- tv.tv_usec = 7000L;
+ tv.tv_usec = 10000L;
char data[10240];
timeval tval;
fd_set sfd;
- tval.tv_usec = 7000L;
+ tval.tv_usec = 10000L;
tval.tv_sec = 0;
int total_in_this_set = 0;
int v = 0;
@@ -3852,7 +3854,7 @@ int InspIRCd(void)
// serverFds timevals went here
- tvs.tv_usec = 7000L;
+ tvs.tv_usec = 30000L;
tvs.tv_sec = 0;
int servresult = select(32767, &serverfds, NULL, NULL, &tvs);
if (servresult > 0)
@@ -3879,7 +3881,7 @@ int InspIRCd(void)
}
}
- for (int cycle = 0; cycle < 4; cycle++) for (int x = 0; x < UDPportCount; x++)
+ for (int x = 0; x < UDPportCount; x++)
{
std::deque<std::string> msgs;
msgs.clear();
@@ -3992,7 +3994,7 @@ int InspIRCd(void)
// tvals defined here
- tval.tv_usec = 7000L;
+ tval.tv_usec = 1000L;
selectResult2 = select(65535, &sfd, NULL, NULL, &tval);
// now loop through all of the items in this pool if any are waiting
@@ -4104,13 +4106,13 @@ int InspIRCd(void)
}
for (int q = 0; q < total_in_this_set; q++)
{
- // there is no iterator += operator :(
- //if (count2 != clientlist.end())
- //{
- count2++;
- //}
+ count2++;
}
}
+
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ sched_yield();
+#endif
// set up select call
for (count = 0; count < boundPortCount; count++)
@@ -4118,7 +4120,7 @@ int InspIRCd(void)
FD_SET (openSockfd[count], &selectFds);
}
- tv.tv_usec = 7000L;
+ tv.tv_usec = 30000L;
selectResult = select(MAXSOCKS, &selectFds, NULL, NULL, &tv);
/* select is reporting a waiting socket. Poll them all to find out which */
@@ -4151,6 +4153,9 @@ int InspIRCd(void)
}
label:
if (0) {};
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ sched_yield();
+#endif
}
/* not reached */
close (incomingSockfd);
diff --git a/src/modules.cpp b/src/modules.cpp
index 2f45ad0d0..fd0f39503 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -453,18 +453,11 @@ chanuserlist Server::GetUsers(chanrec* chan)
{
chanuserlist userl;
userl.clear();
- for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
+ std::vector<char*> *list = chan->GetUsers();
+ for (std::vector<char*>::iterator i = list->begin(); i != list->end(); i++)
{
- if (i->second)
- {
- if (has_channel(i->second,chan))
- {
- if (isnick(i->second->nick))
- {
- userl.push_back(i->second);
- }
- }
- }
+ char* o = *i;
+ userl.push_back((userrec*)o);
}
return userl;
}
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index 123abc500..56df22368 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -47,13 +47,15 @@ int I,I2;
if (MWC)
return true;
-if ((strstr(mask,"*")==0) && (strlen(literal) != strlen(mask)))
+int lenliteral = strlen(literal);
+
+if ((strchr(mask,'*')==0) && (lenliteral != (strlen(mask))))
return 0;
I=0;
I2=0;
while (I < strlen(mask))
{
- if (I2 >= strlen(literal))
+ if (I2 >= lenliteral)
return 0;
if ((mask[I]=='*') && (MWC==0))
@@ -87,7 +89,7 @@ if ((strstr(mask,"*")==0) && (strlen(literal) != strlen(mask)))
I++;
I2++;
}
- if (strlen(literal)==strlen(mask))
+ if (lenliteral==strlen(mask))
MWC=2;
}