]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to deinit resolver
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 11:46:54 +0000 (12:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Sep 2019 11:46:54 +0000 (12:46 +0100)
src/libserver/dns.c
src/libserver/dns.h

index cf4279cf07c6fd6b66aa2300721abced10082de6..bbc9c2b4556f857125d4ab0a4db023fd955a568f 100644 (file)
@@ -642,6 +642,22 @@ rspamd_dns_resolver_init (rspamd_logger_t *logger,
        return dns_resolver;
 }
 
+void
+rspamd_dns_resolver_deinit (struct rspamd_dns_resolver *resolver)
+{
+       if (resolver) {
+               if (resolver->r) {
+                       rdns_resolver_release (resolver->r);
+               }
+
+               if (resolver->ups) {
+                       rspamd_upstreams_destroy (resolver->ups);
+               }
+
+               g_free (resolver);
+       }
+}
+
 
 static struct rdns_upstream_elt*
 rspamd_dns_select_upstream (const char *name,
index a9d822703a19b4357180f59215e06673060513b9..87cc0954b8fd551b4df28e8f58dfd332480947d1 100644 (file)
@@ -46,7 +46,10 @@ struct rspamd_dns_resolver {
  * Init DNS resolver, params are obtained from a config file or system file /etc/resolv.conf
  */
 struct rspamd_dns_resolver *rspamd_dns_resolver_init (rspamd_logger_t *logger,
-                                                                                                         struct ev_loop *ev_base, struct rspamd_config *cfg);
+                                                                                                         struct ev_loop *ev_base,
+                                                                                                         struct rspamd_config *cfg);
+
+void rspamd_dns_resolver_deinit (struct rspamd_dns_resolver *resolver);
 
 struct rspamd_dns_request_ud;