mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-05 17:13: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);
|
||||
|
||||
+10
-2
@@ -502,7 +502,7 @@ int stats_links(aClient *sptr, char *para)
|
||||
ConfigItem_link *link_p;
|
||||
for (link_p = conf_link; link_p; link_p = (ConfigItem_link *) link_p->next)
|
||||
{
|
||||
sendto_one(sptr, ":%s 213 %s C %s@%s * %s %i %s %s%s%s%s%s",
|
||||
sendto_one(sptr, ":%s 213 %s C %s@%s * %s %i %s %s%s%s%s%s%s",
|
||||
me.name, sptr->name, IsOper(sptr) ? link_p->username : "*",
|
||||
IsOper(sptr) ? link_p->hostname : "*", link_p->servername,
|
||||
link_p->port,
|
||||
@@ -511,7 +511,11 @@ int stats_links(aClient *sptr, char *para)
|
||||
(link_p->options & CONNECT_SSL) ? "S" : "",
|
||||
(link_p->options & CONNECT_ZIP) ? "z" : "",
|
||||
(link_p->options & CONNECT_NODNSCACHE) ? "d" : "",
|
||||
(link_p->options & CONNECT_NOHOSTCHECK) ? "h" : "");
|
||||
(link_p->options & CONNECT_NOHOSTCHECK) ? "h" : "",
|
||||
(link_p->flag.temporary == 1) ? "T" : "");
|
||||
#ifdef DEBUGMODE
|
||||
sendnotice(sptr, "%s has refcount %d", link_p->servername, link_p->refcount);
|
||||
#endif
|
||||
if (link_p->hubmask)
|
||||
sendto_one(sptr, ":%s 244 %s H %s * %s",
|
||||
me.name, sptr->name, link_p->hubmask,
|
||||
@@ -1420,6 +1424,10 @@ int stats_class(aClient *sptr, char *para)
|
||||
sendto_one(sptr, rpl_str(RPL_STATSYLINE),
|
||||
me.name, sptr->name, classes->name, classes->pingfreq, classes->connfreq,
|
||||
classes->maxclients, classes->sendq, classes->recvq ? classes->recvq : CLIENT_FLOOD);
|
||||
#ifdef DEBUGMODE
|
||||
sendnotice(sptr, "class '%s' has clients=%d, xrefcount=%d",
|
||||
classes->name, classes->clients, classes->xrefcount);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user