From 673f6484f4dff8fac2cf3029dbd993581b61f370 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 27 Oct 2009 22:27:40 +0000 Subject: [PATCH] making use of resolver cancellation to avoid callback into unloaded plugin --- src/transport/plugin_transport_tcp.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 89c64021e..65abf5fa4 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -404,6 +404,13 @@ struct Plugin }; + +/** + * Handle for request of hostname resolution, non-NULL if pending. + */ +static struct GNUNET_RESOLVER_RequestHandle *hostname_dns; + + /** * Find the session handle for the given peer. */ @@ -2093,11 +2100,11 @@ libgnunet_plugin_transport_tcp_init (void *cls) GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin); GNUNET_OS_network_interfaces_list (&process_interfaces, plugin); - GNUNET_RESOLVER_hostname_resolve (env->sched, - env->cfg, - AF_UNSPEC, - HOSTNAME_RESOLVE_TIMEOUT, - &process_hostname_ips, plugin); + hostname_dns = GNUNET_RESOLVER_hostname_resolve (env->sched, + env->cfg, + AF_UNSPEC, + HOSTNAME_RESOLVE_TIMEOUT, + &process_hostname_ips, plugin); return api; } @@ -2114,6 +2121,11 @@ libgnunet_plugin_transport_tcp_done (void *cls) while (NULL != (session = plugin->sessions)) disconnect_session (session); + if (NULL != hostname_dns) + { + GNUNET_RESOLVER_request_cancel (hostname_dns); + hostname_dns = NULL; + } GNUNET_SERVICE_stop (plugin->service); GNUNET_free (plugin->handlers); GNUNET_free (plugin); -- 2.25.1