summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-16 13:12:32 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-16 13:12:32 +0000
commit0dbcc361f24e1106cf233afd0f46c99f8f2d4d0c (patch)
tree96ae3d8e85eca54b09064245230a5aaceaf0c12c
parentfcc46b271ae45263cb2f7879b9f580655855363c (diff)
Added ability to update routing table on the fly if a connection is lost
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@612 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/inspircd.h2
-rw-r--r--src/InspIRCd.layout22
-rw-r--r--src/connection.cpp11
-rw-r--r--src/inspircd.cpp7
4 files changed, 25 insertions, 17 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index b9e6dec15..cfdb313f0 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -123,5 +123,5 @@ void NetSendToCommon(userrec* u, char* s);
void NetSendToAll(char* s);
void NetSendToOne(char* target,char* s);
void NetSendToAllExcept(char* target,char* s);
-
+void NetSendMyRoutingTable();
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 22664554c..2eaa73694 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -14,8 +14,8 @@ LeftChar=1
Open=1
Top=0
CursorCol=1
-CursorRow=7076
-TopLine=7039
+CursorRow=6463
+TopLine=6433
LeftChar=1
[Editor_2]
@@ -109,9 +109,9 @@ LeftChar=1
[Editor_13]
Open=1
Top=0
-CursorCol=25
-CursorRow=81
-TopLine=4
+CursorCol=1
+CursorRow=68
+TopLine=22
LeftChar=1
[Editor_14]
@@ -139,10 +139,10 @@ TopLine=1
LeftChar=1
[Editor_17]
-Open=0
+Open=1
Top=0
-CursorCol=34
-CursorRow=122
+CursorCol=30
+CursorRow=126
TopLine=63
LeftChar=1
@@ -197,9 +197,9 @@ LeftChar=1
[Editor_24]
Open=1
Top=1
-CursorCol=3
-CursorRow=380
-TopLine=360
+CursorCol=2
+CursorRow=306
+TopLine=264
LeftChar=1
[Editor_25]
Open=1
diff --git a/src/connection.cpp b/src/connection.cpp
index 52ec677c0..a4818cad7 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -182,6 +182,7 @@ bool connection::BeginLink(char* targethost, int port, char* password, char* ser
}
else
{
+ connector.SetState(STATE_DISCONNECTED);
WriteOpers("Could not create outbound connection to %s:%d",targethost,port);
}
}
@@ -212,6 +213,7 @@ bool connection::MeshCookie(char* targethost, int port, long cookie, char* serve
}
else
{
+ connector.SetState(STATE_DISCONNECTED);
WriteOpers("Could not create outbound connection to %s:%d",targethost,port);
}
}
@@ -298,6 +300,10 @@ int ircd_connector::GetState()
void ircd_connector::SetState(int state)
{
this->state = state;
+ if (state == STATE_DISCONNECTED)
+ {
+ NetSendMyRoutingTable();
+ }
}
void ircd_connector::CloseConnection()
@@ -317,7 +323,10 @@ void ircd_connector::SetDescriptor(int fd)
bool connection::SendPacket(char *message, const char* host)
{
ircd_connector* cn = this->FindHost(host);
- strncat(message,"\n",MAXBUF);
+ if (!strchr(message,'\n'))
+ {
+ strncat(message,"\n",MAXBUF);
+ }
if (cn)
{
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 3cc50e9b0..f178a9f0b 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -6492,6 +6492,7 @@ void NetSendMyRoutingTable()
void handle_dollar(char token,char* params,serverrec* source,serverrec* reply, char* udp_host)
{
+ log(DEBUG,"Storing routing table...");
char* sourceserver = strtok(params," ");
char* server = strtok(NULL," ");
for (int i = 0; i < 32; i++)
@@ -6502,6 +6503,8 @@ void handle_dollar(char token,char* params,serverrec* source,serverrec* reply, c
{
if (!strcasecmp(me[i]->connectors[j].GetServerName().c_str(),sourceserver))
{
+ me[i]->connectors[j].routes.clear();
+ log(DEBUG,"Found entry for source server.");
while (server)
{
// store each route
@@ -7123,10 +7126,6 @@ int InspIRCd(void)
{
strncpy(resolved,remotehost,MAXBUF);
}
- log(DEBUG," ");
- log(DEBUG," ");
- log(DEBUG,"Resolved: '%s'",resolved);
- log(DEBUG," ");
// add to this connections ircd_connector vector
me[x]->AddIncoming(incomingSockfd,resolved,ntohs(client.sin_port));
}