aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-18 17:19:04 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-18 17:19:04 +0000
commitbf80e2df3fe48f81c69bb68887376b02ab247e5f (patch)
treed95e835992abf9a2bad5954042ea38e5a6a9df3c /src/or/relay.c
parentb91335117f9faf84001acc65859886e4ddc267a5 (diff)
downloadtor-bf80e2df3fe48f81c69bb68887376b02ab247e5f.tar.gz
tor-bf80e2df3fe48f81c69bb68887376b02ab247e5f.zip
Replace calls to time(NULL) that occur on the order of once per read, one per write, or once per cell with calls to a function that looks at a cached value of time. This is tricksy to benchmark, since it will only help on systems where time() is a syscall and syscalls are relatively slow.
svn:r17690
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 2ced83acbd..5dbed49b4c 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -505,8 +505,7 @@ relay_send_command_from_edge(uint16_t stream_id, circuit_t *circ,
if (cell_direction == CELL_DIRECTION_OUT && circ->n_conn) {
/* if we're using relaybandwidthrate, this conn wants priority */
- /* XXXX021 the call to time() seems little too frequent */
- circ->n_conn->client_used = time(NULL);
+ circ->n_conn->client_used = approx_time();
}
if (cell_direction == CELL_DIRECTION_OUT) {
@@ -1840,7 +1839,7 @@ append_cell_to_circuit_queue(circuit_t *circ, or_connection_t *orconn,
* get called, and we can start putting more data onto the buffer then.
*/
log_debug(LD_GENERAL, "Primed a buffer.");
- connection_or_flush_from_first_active_circuit(orconn, 1, time(NULL));
+ connection_or_flush_from_first_active_circuit(orconn, 1, approx_time());
}
}