summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-11 16:57:13 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-11 16:57:13 +0000
commit5ceee7dfb26c2874c8b70e152b9a9fc451e90b9c (patch)
tree37b76d742af178b1be627a42d8b450673afc40fd /src
parent1faeb26ca4bfb1b99ae314861d41c7424f58b64b (diff)
Attempted fixes for UDP race conditions
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@534 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/connection.cpp2
-rw-r--r--src/inspircd.cpp14
2 files changed, 14 insertions, 2 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 2926ce754..78b9ed17a 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -153,7 +153,7 @@ bool connection::SendPacket(char *message, char* host, int port, long ourkey)
{
fd_set sfd;
timeval tval;
- tval.tv_usec = 1000;
+ tval.tv_usec = 100;
tval.tv_sec = 0;
FD_ZERO(&sfd);
FD_SET(fd,&sfd);
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 8a8dbc761..7351463cc 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -5362,6 +5362,7 @@ void handle_connect(char **parameters, int pcnt, userrec *user)
for (int j = 0; j < 255; j++) {
if (servers[j] == NULL) {
servers[j] = new serverrec;
+ servers[j]->initiator = true;
strcpy(servers[j]->internal_addr,Link_IPAddr);
servers[j]->internal_port = LinkPort;
strcpy(servers[j]->name,Link_ServerName);
@@ -6501,6 +6502,14 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve
case 'F':
WriteOpers("Server %s has completed netburst. (%d secs)",source->name,time(NULL)-nb_start);
handle_F(token,params,source,reply,udp_host,udp_port);
+
+ WriteOpers("Sending my burst now.");
+ nb_start = time(NULL);
+ if (!source->initiator)
+ {
+ DoSync(reply,udp_host,udp_port,MyKey);
+ }
+ WriteOpers("Completed burst to %s (%d secs)",source->name,time(NULL)-nb_start);
break;
// anything else
default:
@@ -6595,7 +6604,10 @@ void handle_link_packet(long theirkey, char* udp_msg, char* udp_host, int udp_po
if (!strcasecmp(servers[i]->internal_addr,udp_host)) {
servers[i]->key = atoi(params);
log(DEBUG,"Key for this server is now %d",servers[i]->key);
- DoSync(serv,udp_host,udp_port,MyKey);
+ if (servers[i]->initiator)
+ {
+ DoSync(serv,udp_host,udp_port,MyKey);
+ }
return;
}
}