[PATCH 5/6] site: Log when resolution completes

Ian Jackson ijackson at chiark.greenend.org.uk
Sat May 17 19:46:34 BST 2014


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 at chiark.greenend.org.uk>

---
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
-- 
1.7.10.4




More information about the sgo-software-discuss mailing list