server/tripe.c: Establish the stdio admin client early.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 13 May 2018 14:31:15 +0000 (15:31 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 25 Jan 2019 12:10:31 +0000 (12:10 +0000)
This way, warnings from peer initialization, for example, are reported
to the stdio admin client rather than stderr.

server/tripe.c

index 6046059..aa225da 100644 (file)
@@ -292,10 +292,7 @@ int main(int argc, char *argv[])
   rand_noisesrc(RAND_GLOBAL, &noise_source);
   rand_seed(RAND_GLOBAL, MAXHASHSZ);
   signal(SIGPIPE, SIG_IGN);
-  for (i = 0; tunnels[i]; i++)
-    tunnels[i]->init();
-  p_init();
-  p_bind(ailist); freeaddrinfo(ailist);
+
   if (!(f & f_daemon)) {
     af = AF_WARN;
 #ifndef NTRACE
@@ -307,6 +304,11 @@ int main(int argc, char *argv[])
     a_switcherr();
   }
 
+  p_init();
+  for (i = 0; tunnels[i]; i++)
+    tunnels[i]->init();
+  p_bind(ailist); freeaddrinfo(ailist);
+
   for (i = 0; tunnels[i]; i++) {
     if (tunnels[i]->flags&TUNF_PRIVOPEN) {
       ps_split(f & f_daemon);