From 4ac8a7d28bb43e846430ae4c46fe83109c1161bf Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 17 May 2014 16:57:10 +0100 Subject: [PATCH] site: Log when resolution completes This helps with debugging dns and reentrancy problems. Also, assert in ensure_resolving that we have an address. This makes it slightly clearer that callers are expected to have checked this. Signed-off-by: Ian Jackson --- New patch in v2 of the series. --- site.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/site.c b/site.c index b04f3b3..0e2c43a 100644 --- a/site.c +++ b/site.c @@ -1161,6 +1161,8 @@ static void site_resolve_callback(void *sst, struct in_addr *address) ca_buf.sin.sin_port=htons(st->remoteport); ca_buf.sin.sin_addr=*address; ca_use=&ca_buf; + slog(st,LOG_STATE,"resolution of %s completed: %s", + st->address, comm_addr_to_string(ca_use));; } else { slog(st,LOG_ERROR,"resolution of %s failed",st->address); ca_use=0; @@ -1295,6 +1297,8 @@ static bool_t ensure_resolving(struct site *st) if (st->resolving) return True; + assert(st->address); + /* resolver->request might reentrantly call site_resolve_callback * which will clear st->resolving, so we need to set it beforehand * rather than afterwards; also, it might return False, in which -- 2.30.2