summaryrefslogtreecommitdiff
path: root/src/connection.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-19 09:40:41 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-19 09:40:41 +0000
commitb308d00aaa5ac508b7ad5c1d1279d1b0c463582a (patch)
treec23b3f85fcfa8ca0a3b32185802c429ab911db83 /src/connection.cpp
parentd25c8309ce2a6b8458b57df57b75f75cf1b85ba8 (diff)
/WHO and routing fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@670 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/connection.cpp')
-rw-r--r--src/connection.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 4161b0447..ce166ace0 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -345,19 +345,23 @@ bool connection::SendPacket(char *message, const char* host)
if (cn->GetState() == STATE_DISCONNECTED)
{
log(DEBUG,"Main route to %s is down, seeking alternative",host);
- // this route is down, we must re-route the packet through an available point in the mesh.
- for (int k = 0; k < this->connectors.size(); k++)
+ // fix: can only route one hop to avoid a loop
+ if (strncat(message,"R ",2))
{
- // search for another point in the mesh which can 'reach' where we want to go
- for (int m = 0; m < this->connectors[k].routes.size(); m++)
+ // this route is down, we must re-route the packet through an available point in the mesh.
+ for (int k = 0; k < this->connectors.size(); k++)
{
- if (!strcasecmp(this->connectors[k].routes[m].c_str(),host))
+ // search for another point in the mesh which can 'reach' where we want to go
+ for (int m = 0; m < this->connectors[k].routes.size(); m++)
{
- log(DEBUG,"Found alternative route for packet: %s",this->connectors[k].GetServerName().c_str());
- char buffer[MAXBUF];
- snprintf(buffer,MAXBUF,"R %s %s",host,message);
- this->SendPacket(buffer,this->connectors[k].GetServerName().c_str());
- return true;
+ if (!strcasecmp(this->connectors[k].routes[m].c_str(),host))
+ {
+ log(DEBUG,"Found alternative route for packet: %s",this->connectors[k].GetServerName().c_str());
+ char buffer[MAXBUF];
+ snprintf(buffer,MAXBUF,"R %s %s",host,message);
+ this->SendPacket(buffer,this->connectors[k].GetServerName().c_str());
+ return true;
+ }
}
}
}