race condition fixes

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@537 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2004-04-11 17:22:52 +00:00
parent 93f59f53c2
commit 292bab4c81
4 changed files with 30 additions and 19 deletions

View File

@ -49,7 +49,7 @@ class serverrec : public connection
*/
char description[MAXBUF];
bool initiator;
bool sync_soon;
/** Constructor
*/

View File

@ -13,9 +13,9 @@ LeftChar=1
[Editor_1]
Open=1
Top=1
CursorCol=95
CursorRow=5399
TopLine=5377
CursorCol=13
CursorRow=6933
TopLine=6881
LeftChar=1
[Editor_2]
@ -45,8 +45,8 @@ LeftChar=1
[Editor_5]
Open=1
Top=0
CursorCol=2
CursorRow=26
CursorCol=1
CursorRow=23
TopLine=1
LeftChar=1
@ -109,9 +109,9 @@ LeftChar=1
[Editor_13]
Open=1
Top=0
CursorCol=20
CursorRow=59
TopLine=18
CursorCol=6
CursorRow=30
TopLine=20
LeftChar=1
[Editor_14]
@ -173,9 +173,9 @@ LeftChar=1
[Editor_21]
Open=1
Top=0
CursorCol=3
CursorRow=59
TopLine=7
CursorCol=1
CursorRow=68
TopLine=13
LeftChar=1
[Editor_22]
@ -197,9 +197,9 @@ LeftChar=1
[Editor_24]
Open=1
Top=0
CursorCol=1
CursorRow=1
TopLine=1
CursorCol=3
CursorRow=320
TopLine=271
LeftChar=1
[Editor_25]
Open=1

View File

@ -6570,6 +6570,7 @@ void handle_link_packet(long theirkey, char* udp_msg, char* udp_host, int udp_po
strcpy(servers[j]->description,serverdesc);
servers[j]->internal_port = udp_port;
// create a server record for this server
WriteOpers("Server %s authenticated, exchanging server keys...",servername);
snprintf(response,10240,"O %d",MyKey);
serv->SendPacket(response,udp_host,udp_port,0);
return;
@ -6604,10 +6605,7 @@ 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);
//if (servers[i]->initiator)
//{
DoSync(serv,udp_host,udp_port,MyKey);
//}
servers[i]->sync_soon = true;
return;
}
}
@ -6925,6 +6923,17 @@ int InspIRCd(void)
}
fd_reap.clear();
reap_counter=0;
for (int j = 0; j < 255; j++)
{
if (servers[j])
{
if (servers[j]->sync_soon)
{
servers[j]->sync_soon = false;
DoSync(servers[j],servers[j]->internal_addr,servers[j]->internal_port,MyKey);
}
}
}
}

View File

@ -19,6 +19,7 @@ serverrec::serverrec()
signon = time(NULL);
jupiter = false;
fd = 0;
sync_soon = false;
}
@ -36,5 +37,6 @@ serverrec::serverrec(char* n, long ver, bool jupe)
signon = time(NULL);
jupiter = jupe;
fd = 0;
sync_soon = false;
}