summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-03-03 21:56:15 +0100
committerChristian Grothoff <christian@grothoff.org>2018-03-03 21:56:15 +0100
commitcd2b8b467b218dfdd2d5124ad2d835161f3a2b1a (patch)
tree6f4d674cc117b27c6187c0203d46930d5fc13e5e
parent908626e8e19695aa5cd291e5033761ed744d5332 (diff)
handle case where resolver operation is cancelled during success callback
-rw-r--r--src/util/resolver_api.c32
1 files changed, 19 insertions, 13 deletions
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]);