[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] sched: make interval a plain int; initialize with macro



commit 7bbc29b0f27581b77a16c97e5125d60150447591
Author: Matt Traudt <sirmatt@xxxxxxx>
Date:   Mon Sep 25 10:43:15 2017 -0400

    sched: make interval a plain int; initialize with macro
---
 src/or/or.h             |  2 +-
 src/or/scheduler.h      |  2 +-
 src/or/scheduler_kist.c | 16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/or/or.h b/src/or/or.h
index 9a9a70ccc..a90841fbc 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4615,7 +4615,7 @@ typedef struct {
    * not use the KIST scheduler but use the old vanilla scheduler instead. If
    * zero, do what the consensus says and fall back to using KIST as if this is
    * set to "10 msec" if the consensus doesn't say anything. */
-  uint32_t KISTSchedRunInterval;
+  int KISTSchedRunInterval;
 
   /** A multiplier for the KIST per-socket limit calculation. */
   double KISTSockBufSizeFactor;
diff --git a/src/or/scheduler.h b/src/or/scheduler.h
index e32a662c8..0ec24db93 100644
--- a/src/or/scheduler.h
+++ b/src/or/scheduler.h
@@ -189,7 +189,7 @@ int scheduler_can_use_kist(void);
 void scheduler_kist_set_full_mode(void);
 void scheduler_kist_set_lite_mode(void);
 scheduler_t *get_kist_scheduler(void);
-uint32_t kist_scheduler_run_interval(const networkstatus_t *ns);
+int kist_scheduler_run_interval(const networkstatus_t *ns);
 
 #ifdef TOR_UNIT_TESTS
 extern int32_t sched_run_interval;
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c
index 8fe3ff556..9e960cdef 100644
--- a/src/or/scheduler_kist.c
+++ b/src/or/scheduler_kist.c
@@ -91,7 +91,7 @@ static monotime_t scheduler_last_run;
  */
 static double sock_buf_size_factor = 1.0;
 /* How often the scheduler runs. */
-STATIC int32_t sched_run_interval = 10;
+STATIC int sched_run_interval = KIST_SCHED_RUN_INTERVAL_DEFAULT;
 
 #ifdef HAVE_KIST_SUPPORT
 /* Indicate if KIST lite mode is on or off. We can disable it at runtime.
@@ -355,7 +355,7 @@ outbuf_table_remove(outbuf_table_t *table, channel_t *chan)
 static void
 set_scheduler_run_interval(const networkstatus_t *ns)
 {
-  int32_t old_sched_run_interval = sched_run_interval;
+  int old_sched_run_interval = sched_run_interval;
   sched_run_interval = kist_scheduler_run_interval(ns);
   if (old_sched_run_interval != sched_run_interval) {
     log_info(LD_SCHED, "Scheduler KIST changing its running interval "
@@ -494,7 +494,7 @@ kist_scheduler_init(void)
   IF_BUG_ONCE(sched_run_interval == 0) {
     log_warn(LD_SCHED, "We are initing the KIST scheduler and noticed the "
              "KISTSchedRunInterval is telling us to not use KIST. That's "
-             "weird! We'll continue using KIST, but at %dms.",
+             "weird! We'll continue using KIST, but at %" PRId32 "ms.",
              KIST_SCHED_RUN_INTERVAL_DEFAULT);
     sched_run_interval = KIST_SCHED_RUN_INTERVAL_DEFAULT;
   }
@@ -714,13 +714,13 @@ get_kist_scheduler(void)
  *   - If > 0, then return the positive consensus value
  *   - If consensus doesn't say anything, return 10 milliseconds, default.
  */
-uint32_t
+int
 kist_scheduler_run_interval(const networkstatus_t *ns)
 {
-  uint32_t run_interval = get_options()->KISTSchedRunInterval;
+  int run_interval = get_options()->KISTSchedRunInterval;
 
   if (run_interval != 0) {
-    log_debug(LD_SCHED, "Found KISTSchedRunInterval=%" PRIu32 " in torrc. "
+    log_debug(LD_SCHED, "Found KISTSchedRunInterval=%" PRId32 " in torrc. "
                         "Using that.", run_interval);
     return run_interval;
   }
@@ -768,9 +768,9 @@ scheduler_can_use_kist(void)
 
   /* We do have the support, time to check if we can get the interval that the
    * consensus can be disabling. */
-  uint32_t run_interval = kist_scheduler_run_interval(NULL);
+  int run_interval = kist_scheduler_run_interval(NULL);
   log_debug(LD_SCHED, "Determined KIST sched_run_interval should be "
-                      "%" PRIu32 ". Can%s use KIST.",
+                      "%" PRId32 ". Can%s use KIST.",
            run_interval, (run_interval > 0 ? "" : " not"));
   return run_interval > 0;
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits