[tor-bugs] #18365 [Core Tor/Tor]: Fined-grain timer implementation to support per-connection or per-circuit timers

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Apr 22 14:24:25 UTC 2016


#18365: Fined-grain timer implementation to support per-connection or per-circuit
timers
-------------------------------------------------+-------------------------
 Reporter:  nickm                                |          Owner:  nickm
     Type:  enhancement                          |         Status:
 Priority:  Medium                               |  needs_revision
Component:  Core Tor/Tor                         |      Milestone:  Tor:
 Severity:  Normal                               |  0.2.9.x-final
 Keywords:  performance, backend,                |        Version:
  TorCoreTeam201604                              |     Resolution:
Parent ID:                                       |  Actual Points:  medium
 Reviewer:                                       |         Points:  medium
                                                 |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by cypherpunks):

 When running the timers test under Valgrind it ends up in one of the
 warning states. Valgrind then starts reporting there are memory leaks
 because these states return from main without cleaning up. See the
 following patch for a possible fix.
 {{{
 diff --git a/src/test/test-timers.c b/src/test/test-timers.c
 index 2896e49..35906a1 100644
 --- a/src/test/test-timers.c
 +++ b/src/test/test-timers.c
 @@ -59,6 +59,7 @@ main(int argc, char **argv)
    timers_initialize();

    int i;
 +  int ret;
    struct timeval now;
    tor_gettimeofday(&now);
    for (i = 0; i < N_TIMERS; ++i) {
 @@ -109,13 +110,14 @@ main(int argc, char **argv)
    if (mean_diff > 500*1000 || stddev > 500*1000) {
      printf("Either your system is under ridiculous load, or the "
             "timer backend is broken.\n");
 -    return 1;
 +    ret = 1;
    } else if (mean_diff > 2000 || stddev > 2000) {
      printf("Either your system is a bit slow or the "
             "timer backend is odd.\n");
 -    return 0;
 +    ret = 0;
    } else {
      printf("Looks good enough.\n");
 +    ret = 0;
    }

    timer_free(NULL);
 @@ -124,5 +126,5 @@ main(int argc, char **argv)
      timer_free(timers[i]);
    }
    timers_shutdown();
 -  return 0;
 +  return ret;
  }
 }}}
 One nitpick are the magic values in the if statements. Maybe use
 descriptive defines for these?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/18365#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list