chiark / gitweb /
site logging: Log peer addresses on timeout
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 11 May 2014 18:12:56 +0000 (19:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 May 2014 01:02:14 +0000 (02:02 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
site.c

diff --git a/site.c b/site.c
index 1d8c777..fe0e1a7 100644 (file)
--- a/site.c
+++ b/site.c
@@ -347,9 +347,27 @@ static void logtimeout(struct site *st, const char *fmt, ...)
 FORMAT(printf,2,3);
 static void logtimeout(struct site *st, const char *fmt, ...)
 {
+    uint32_t class=event_log_priority(st,LOG_SETUP_TIMEOUT);
+    if (!class)
+       return;
+
     va_list ap;
     va_start(ap,fmt);
-    vslog(st,LOG_SETUP_TIMEOUT,fmt,ap);
+
+    slilog_part(st->log,class,"%s: ",st->tunname);
+    vslilog_part(st->log,class,fmt,ap);
+
+    const char *delim;
+    int i;
+    for (i=0, delim=" (tried ";
+        i<st->setup_peers.npeers;
+        i++, delim=", ") {
+       transport_peer *peer=&st->setup_peers.peers[i];
+       const char *s=comm_addr_to_string(&peer->addr);
+       slilog_part(st->log,class,"%s%s",delim,s);
+    }
+
+    slilog_part(st->log,class,")\n");
     va_end(ap);
 }