mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 15:43:12 +02:00
- Fixed "quickly-rehashing + autoconnect linkblocks = crash"-bug. This involved fixing
multiple reference count bugs, one related to sptr->serv->conf, and another one related to sptr->serv->class. Both caused problems when someone did a /rehash when a server was in the process of connecting (so it might also happen when connfreq was hit and you did a /rehash). Original bug was reported by sh0 (#0001872).
This commit is contained in:
@@ -593,6 +593,7 @@ int m_server_synch(aClient *cptr, long numeric, ConfigItem_link *aconf)
|
||||
aClient *acptr;
|
||||
int i;
|
||||
char buf[BUFSIZE];
|
||||
int incoming = IsUnknown(cptr) ? 1 : 0;
|
||||
|
||||
ircd_log(LOG_SERVER, "SERVER %s", cptr->name);
|
||||
|
||||
@@ -601,7 +602,7 @@ int m_server_synch(aClient *cptr, long numeric, ConfigItem_link *aconf)
|
||||
MyFree(cptr->passwd);
|
||||
cptr->passwd = NULL;
|
||||
}
|
||||
if (IsUnknown(cptr))
|
||||
if (incoming)
|
||||
{
|
||||
/* If this is an incomming connection, then we have just received
|
||||
* their stuff and now send our stuff back.
|
||||
@@ -684,7 +685,12 @@ int m_server_synch(aClient *cptr, long numeric, ConfigItem_link *aconf)
|
||||
cptr->srvptr = &me;
|
||||
cptr->serv->numeric = numeric;
|
||||
cptr->serv->conf = aconf;
|
||||
cptr->serv->conf->refcount++;
|
||||
if (incoming)
|
||||
{
|
||||
cptr->serv->conf->refcount++;
|
||||
Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d",
|
||||
cptr->name, cptr->serv->conf->servername, cptr->serv->conf->refcount));
|
||||
}
|
||||
cptr->serv->conf->class->clients++;
|
||||
cptr->class = cptr->serv->conf->class;
|
||||
add_server_to_table(cptr);
|
||||
|
||||
Reference in New Issue
Block a user