chiark / gitweb /
site: Log when resolution completes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 17 May 2014 15:57:10 +0000 (16:57 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 18 May 2014 13:53:13 +0000 (14:53 +0100)
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 <ijackson@chiark.greenend.org.uk>
---
New patch in v2 of the series.

site.c

diff --git a/site.c b/site.c
index b04f3b3..0e2c43a 100644 (file)
--- 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