From: Christian Grothoff Date: Sat, 3 Mar 2018 20:56:15 +0000 (+0100) Subject: handle case where resolver operation is cancelled during success callback X-Git-Tag: v0.11.0pre66~187^2~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cd2b8b467b218dfdd2d5124ad2d835161f3a2b1a;p=oweals%2Fgnunet.git handle case where resolver operation is cancelled during success callback --- diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index bd46b4fbb..b92fd6a02 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -500,11 +500,13 @@ handle_response (void *cls, GNUNET_free (nret); } /* finally, make termination call */ - rh->name_callback (rh->cls, - NULL); + if (GNUNET_SYSERR != rh->was_transmitted) + rh->name_callback (rh->cls, + NULL); } - if (NULL != rh->addr_callback) - rh->addr_callback (rh->cls, + if ( (NULL != rh->addr_callback) && + (GNUNET_SYSERR != rh->was_transmitted) ) + rh->addr_callback (rh->cls, NULL, 0); } @@ -637,6 +639,7 @@ numeric_resolution (void *cls) (const struct sockaddr *) &v4, sizeof (v4)); if ( (rh->af == AF_UNSPEC) && + (GNUNET_SYSERR != rh->was_transmitted) && (1 == inet_pton (AF_INET6, hostname, &v6.sin6_addr)) ) @@ -646,9 +649,10 @@ numeric_resolution (void *cls) (const struct sockaddr *) &v6, sizeof (v6)); } - rh->addr_callback (rh->cls, - NULL, - 0); + if (GNUNET_SYSERR != rh->was_transmitted) + rh->addr_callback (rh->cls, + NULL, + 0); GNUNET_free (rh); return; } @@ -661,9 +665,10 @@ numeric_resolution (void *cls) rh->addr_callback (rh->cls, (const struct sockaddr *) &v6, sizeof (v6)); - rh->addr_callback (rh->cls, - NULL, - 0); + if (GNUNET_SYSERR != rh->was_transmitted) + rh->addr_callback (rh->cls, + NULL, + 0); GNUNET_free (rh); return; } @@ -725,9 +730,10 @@ loopback_resolution (void *cls) GNUNET_break (0); break; } - rh->addr_callback (rh->cls, - NULL, - 0); + if (GNUNET_SYSERR != rh->was_transmitted) + rh->addr_callback (rh->cls, + NULL, + 0); LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished resolving hostname `%s'.\n", (const char *) &rh[1]);