aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-03-26 01:34:42 -0400
committerNick Mathewson <nickm@torproject.org>2011-03-30 14:41:41 -0400
commitaa950e6c48471f00ff9497fa4e9fad1c71e75868 (patch)
tree58a1a24fafb531c7f4214cba8a1bf98041fe6ae6 /src/or/circuitlist.c
parent5eaba5ac2128eebf095441e23b6b7516ce35dd5d (diff)
downloadtor-aa950e6c48471f00ff9497fa4e9fad1c71e75868.tar.gz
tor-aa950e6c48471f00ff9497fa4e9fad1c71e75868.zip
Use timevals, not time_t, when expiring circuits.
We've got millisecond timers now, we might as well use them. This change won't actually make circuits get expiered with microsecond precision, since we only call the expiry functions once per second. Still, it should avoid the situation where we have a circuit get expired too early because of rounding. A couple of the expiry functions now call tor_gettimeofday: this should be cheap since we're only doing it once per second. If it gets to be called more often, though, we should onsider having the current time be an argument again.
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index b4f5f45615..d1fea37c25 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -398,8 +398,7 @@ circuit_initial_package_window(void)
static void
init_circuit_base(circuit_t *circ)
{
- circ->timestamp_created = time(NULL);
- tor_gettimeofday(&circ->highres_created);
+ tor_gettimeofday(&circ->timestamp_created);
circ->package_window = circuit_initial_package_window();
circ->deliver_window = CIRCWINDOW_START;
@@ -609,9 +608,10 @@ circuit_dump_details(int severity, circuit_t *circ, int conn_array_index,
const char *type, int this_circid, int other_circid)
{
log(severity, LD_CIRC, "Conn %d has %s circuit: circID %d (other side %d), "
- "state %d (%s), born %d:",
+ "state %d (%s), born %ld:",
conn_array_index, type, this_circid, other_circid, circ->state,
- circuit_state_to_string(circ->state), (int)circ->timestamp_created);
+ circuit_state_to_string(circ->state),
+ (long)circ->timestamp_created.tv_sec);
if (CIRCUIT_IS_ORIGIN(circ)) { /* circ starts at this node */
circuit_log_path(severity, LD_CIRC, TO_ORIGIN_CIRCUIT(circ));
}