summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/connection.cpp1
-rw-r--r--src/inspircd.cpp47
2 files changed, 48 insertions, 0 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 20695e873..514897ecb 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -364,6 +364,7 @@ bool connection::SendPacket(char *message, const char* host)
snprintf(buffer,MAXBUF,"& %s",host);
NetSendToAllExcept(host,buffer);
log(DEBUG,"There are no routes to %s, we're gonna boot the server off!",host);
+ DoSplit(host);
return false;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 55a38a353..0aadf62ea 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -6560,6 +6560,53 @@ void handle_dollar(char token,char* params,serverrec* source,serverrec* reply, c
log(DEBUG,"Warning! routing table received from nonexistent server!");
}
+
+void DoSplit(const char* params)
+{
+ bool go_again = true;
+ while (go_again)
+ {
+ go_again = false;
+ for (int i = 0; i < 32; i++)
+ {
+ if (me[i] != NULL)
+ {
+ for (vector<ircd_connector>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++)
+ {
+ if (!strcasecmp(j->GetServerName().c_str(),params))
+ {
+ j->routes.clear();
+ j->CloseConnection();
+ me[i]->connectors.erase(j);
+ go_again = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ log(DEBUG,"Removed server. Will remove clients...");
+ // iterate through the userlist and remove all users on this server.
+ // because we're dealing with a mesh, we dont have to deal with anything
+ // "down-route" from this server (nice huh)
+ go_again = true;
+ char reason[MAXBUF];
+ snprintf(reason,MAXBUF,"%s %s",ServerName,params);
+ while (go_again)
+ {
+ go_again = false;
+ for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++)
+ {
+ if (!strcasecmp(u->second->server,params))
+ {
+ kill_link(u->second,reason);
+ go_again = true;
+ break;
+ }
+ }
+ }
+}
+
void handle_amp(char token,char* params,serverrec* source,serverrec* reply, char* udp_host)
{
log(DEBUG,"Netsplit! %s split from mesh, removing!",params);