mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-11 19:49:02 -04:00
Added some netsplit handling stuff (untested)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@613 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
0dbcc361f2
commit
a9682a795a
@ -1,5 +1,5 @@
|
||||
[Editors]
|
||||
Focused=24
|
||||
Focused=1
|
||||
Order=1,2,4,6,3,7,25,5,24,-1
|
||||
|
||||
[Editor_0]
|
||||
@ -12,10 +12,10 @@ LeftChar=1
|
||||
|
||||
[Editor_1]
|
||||
Open=1
|
||||
Top=0
|
||||
CursorCol=1
|
||||
CursorRow=6463
|
||||
TopLine=6433
|
||||
Top=1
|
||||
CursorCol=11
|
||||
CursorRow=6564
|
||||
TopLine=6517
|
||||
LeftChar=1
|
||||
|
||||
[Editor_2]
|
||||
@ -196,11 +196,11 @@ LeftChar=1
|
||||
|
||||
[Editor_24]
|
||||
Open=1
|
||||
Top=1
|
||||
CursorCol=2
|
||||
CursorRow=306
|
||||
TopLine=264
|
||||
LeftChar=1
|
||||
Top=0
|
||||
CursorCol=40
|
||||
CursorRow=356
|
||||
TopLine=303
|
||||
LeftChar=8
|
||||
[Editor_25]
|
||||
Open=1
|
||||
Top=0
|
||||
|
@ -323,6 +323,7 @@ void ircd_connector::SetDescriptor(int fd)
|
||||
bool connection::SendPacket(char *message, const char* host)
|
||||
{
|
||||
ircd_connector* cn = this->FindHost(host);
|
||||
|
||||
if (!strchr(message,'\n'))
|
||||
{
|
||||
strncat(message,"\n",MAXBUF);
|
||||
@ -351,7 +352,10 @@ bool connection::SendPacket(char *message, const char* host)
|
||||
}
|
||||
}
|
||||
}
|
||||
log(DEBUG,"ERROR: Main route to %s is down and there are no possible routes to this server!",host);
|
||||
char buffer[MAXBUF];
|
||||
snprintf(buffer,MAXBUF,"& %s",host);
|
||||
NetSendToAll(buffer);
|
||||
log(DEBUG,"There are no routes to %s, we're gonna boot the server off!",host);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6520,6 +6520,53 @@ void handle_dollar(char token,char* params,serverrec* source,serverrec* reply, c
|
||||
log(DEBUG,"Warning! routing table received from nonexistent server!");
|
||||
}
|
||||
|
||||
void handle_amp(char token,char* params,serverrec* source,serverrec* reply, char* udp_host)
|
||||
{
|
||||
log(DEBUG,"Netsplit! %s split from mesh, removing!",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 process_restricted_commands(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,char* ipaddr,int port)
|
||||
{
|
||||
@ -6560,6 +6607,11 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve
|
||||
case '$':
|
||||
handle_dollar(token,params,source,reply,udp_host);
|
||||
break;
|
||||
// node unreachable - we cant route to a server, sooooo we slit it off.
|
||||
// servers can generate these for themselves for an squit.
|
||||
case '&':
|
||||
handle_amp(token,params,source,reply,udp_host);
|
||||
break;
|
||||
// R <server> <data>
|
||||
// redirect token, send all of <data> along to the given
|
||||
// server as this server has been found to still have a route to it
|
||||
|
Loading…
x
Reference in New Issue
Block a user