canx any pending dns queries when we unload a module
This commit is contained in:
parent
1dc41f7b84
commit
d3b735ca3a
3 changed files with 28 additions and 0 deletions
3
dl.c
3
dl.c
|
@ -35,6 +35,7 @@
|
|||
#include "hash.h"
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "dns.h"
|
||||
#ifdef SQLSRV
|
||||
#include "sqlsrv/rta.h"
|
||||
#endif
|
||||
|
@ -1591,6 +1592,8 @@ unload_module (char *module_name, User * u)
|
|||
return NS_FAILURE;
|
||||
}
|
||||
|
||||
/* canx any DNS queries running */
|
||||
canx_dns(module_name);
|
||||
/* Check to see if this Module has any timers registered.... */
|
||||
del_mod_timers (module_name);
|
||||
|
||||
|
|
24
dns.c
24
dns.c
|
@ -171,6 +171,30 @@ fini_adns() {
|
|||
list_destroy_nodes(dnslist);
|
||||
free(ads);
|
||||
}
|
||||
/** @brief Canx any DNS queries for modules we might be unloading
|
||||
*
|
||||
* @param module name
|
||||
* @return Nothing
|
||||
*/
|
||||
void
|
||||
canx_dns(const char *modname) {
|
||||
lnode_t *dnsnode;
|
||||
DnsLookup *dnsdata;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
|
||||
dnsnode = list_first (dnslist);
|
||||
while (dnsnode) {
|
||||
dnsdata = lnode_get(dnsnode);
|
||||
if (!ircstrcasecmp(dnsdata->mod_name, modname)) {
|
||||
adns_cancel(dnsdata->q);
|
||||
free (dnsdata->a);
|
||||
free (dnsdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @brief Checks for Completed DNS queries
|
||||
*
|
||||
|
|
1
dns.h
1
dns.h
|
@ -27,4 +27,5 @@
|
|||
int init_dns (void);
|
||||
void do_dns (void);
|
||||
void fini_adns();
|
||||
void canx_dns(const char *modname);
|
||||
#endif /* _DNS_H_ */
|
||||
|
|
Reference in a new issue