]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Refactor control_event_bootstrap_core() more
authorTaylor Yu <catalyst@torproject.org>
Tue, 28 Aug 2018 19:52:44 +0000 (14:52 -0500)
committerTaylor Yu <catalyst@torproject.org>
Mon, 10 Sep 2018 18:18:32 +0000 (13:18 -0500)
Eliminate a few conditional expressions in
control_event_bootstrap_core() by overwriting the status parameter.

src/feature/control/control.c

index 4395cbd2c9cd4433eeb2982bd2558bfb918995c5..64785a758d2d5089030aa0e365fb97533e26081a 100644 (file)
@@ -7106,12 +7106,15 @@ control_event_bootstrap_core(int loglevel, bootstrap_status_t status,
   const char *tag, *summary;
 
   bootstrap_status_to_string(status, &tag, &summary);
+  /* Locally reset status if there's incremental progress */
+  if (progress)
+    status = progress;
 
   tor_log(loglevel, LD_CONTROL,
-          "Bootstrapped %d%%: %s", progress ? progress : status, summary);
+          "Bootstrapped %d%%: %s", status, summary);
   tor_snprintf(buf, sizeof(buf),
                "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\"",
-               progress ? progress : status, tag, summary);
+               status, tag, summary);
   tor_snprintf(last_sent_bootstrap_message,
                sizeof(last_sent_bootstrap_message),
                "NOTICE %s", buf);