summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-17 16:29:45 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-17 16:29:45 +0000
commitfcf2bac28ad748045bd3bc2bea99e77d1b57f693 (patch)
tree6ec11debe10f9d750b9468d06bc58bf488734c29 /src/inspircd.cpp
parentead90099d2867c5d3ecc3a921dcdfdc942c0135f (diff)
Moved a load of servers-only stuff into serverrec out of the way of userrec
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1417 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp58
1 files changed, 27 insertions, 31 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 701b95381..d5156117a 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2855,49 +2855,45 @@ int InspIRCd(char** argv, int argc)
}
}
+ std::deque<std::string> msgs;
+ std::deque<std::string> sums;
for (int x = 0; x < SERVERportCount; x++)
{
- std::deque<std::string> msgs;
- std::deque<std::string> sums;
- msgs.clear();
sums.clear();
- if (me[x])
+ msgs.clear();
+ while ((me[x]) && (me[x]->RecvPacket(msgs, tcp_host, sums))) // returns 0 or more lines (can be multiple lines!)
{
- sums.clear();
- msgs.clear();
- while (me[x]->RecvPacket(msgs, tcp_host, sums))
+ for (int ctr = 0; ctr < msgs.size(); ctr++)
{
- for (int ctr = 0; ctr < msgs.size(); ctr++)
+ strlcpy(tcp_msg,msgs[ctr].c_str(),MAXBUF);
+ strlcpy(tcp_sum,msgs[ctr].c_str(),MAXBUF);
+ log(DEBUG,"Processing: %s",tcp_msg);
+ if (!tcp_msg[0])
+ {
+ log(DEBUG,"Invalid string from %s [route%lu]",tcp_host,(unsigned long)x);
+ break;
+ }
+ // during a netburst, send all data to all other linked servers
+ if ((((nb_start>0) && (tcp_msg[0] != 'Y') && (tcp_msg[0] != 'X') && (tcp_msg[0] != 'F'))) || (is_uline(tcp_host)))
{
- strlcpy(tcp_msg,msgs[ctr].c_str(),MAXBUF);
- strlcpy(tcp_sum,msgs[ctr].c_str(),MAXBUF);
- log(DEBUG,"Processing: %s",tcp_msg);
- if (!tcp_msg[0])
- {
- log(DEBUG,"Invalid string from %s [route%lu]",tcp_host,(unsigned long)x);
- break;
- }
- // during a netburst, send all data to all other linked servers
- if ((((nb_start>0) && (tcp_msg[0] != 'Y') && (tcp_msg[0] != 'X') && (tcp_msg[0] != 'F'))) || (is_uline(tcp_host)))
+ if (is_uline(tcp_host))
{
- if (is_uline(tcp_host))
+ if ((tcp_msg[0] != 'Y') && (tcp_msg[0] != 'X') && (tcp_msg[0] != 'F'))
{
- if ((tcp_msg[0] != 'Y') && (tcp_msg[0] != 'X') && (tcp_msg[0] != 'F'))
- {
- NetSendToAllExcept_WithSum(tcp_host,tcp_msg,tcp_sum);
- }
- }
- else
NetSendToAllExcept_WithSum(tcp_host,tcp_msg,tcp_sum);
+ }
}
- std::string msg = tcp_msg;
- FOREACH_MOD OnPacketReceive(msg,tcp_host);
- strlcpy(tcp_msg,msg.c_str(),MAXBUF);
- if (me[x])
- handle_link_packet(tcp_msg, tcp_host, me[x], tcp_sum);
+ else
+ NetSendToAllExcept_WithSum(tcp_host,tcp_msg,tcp_sum);
}
- //goto label;
+ std::string msg = tcp_msg;
+ FOREACH_MOD OnPacketReceive(msg,tcp_host);
+ strlcpy(tcp_msg,msg.c_str(),MAXBUF);
+ if (me[x])
+ handle_link_packet(tcp_msg, tcp_host, me[x], tcp_sum);
}
+ sums.clear(); // we're done, clear the list for the next operation
+ msgs.clear();
}
}