From b33b366a7f8bcab1c9b4859788e3b2c7d3dcf180 Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Sat, 25 May 2013 13:04:33 +0200 Subject: Tweak CIRC_BW event based on comments by nickm. - Rename n_read and n_written in origin_circuit_t to make it clear that these are only used for CIRC_BW events. - Extract new code in control_update_global_event_mask to new clear_circ_bw_fields function. --- src/or/connection.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/or/connection.c') diff --git a/src/or/connection.c b/src/or/connection.c index 2f2a421fc..88def49e5 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -3271,7 +3271,7 @@ connection_read_to_buf(connection_t *conn, ssize_t *max_to_read, /* change *max_to_read */ *max_to_read = at_most - n_read; - /* Update edge_conn->n_read and ocirc->n_read */ + /* Update edge_conn->n_read and ocirc->n_read_circ_bw */ if (conn->type == CONN_TYPE_AP) { edge_connection_t *edge_conn = TO_EDGE_CONN(conn); circuit_t *circ = circuit_get_by_edge_conn(edge_conn); @@ -3285,10 +3285,10 @@ connection_read_to_buf(connection_t *conn, ssize_t *max_to_read, if (circ && CIRCUIT_IS_ORIGIN(circ)) { ocirc = TO_ORIGIN_CIRCUIT(circ); - if (PREDICT_LIKELY(UINT32_MAX - ocirc->n_read > n_read)) - ocirc->n_read += (int)n_read; + if (PREDICT_LIKELY(UINT32_MAX - ocirc->n_read_circ_bw > n_read)) + ocirc->n_read_circ_bw += (int)n_read; else - ocirc->n_read = UINT32_MAX; + ocirc->n_read_circ_bw = UINT32_MAX; } } @@ -3752,10 +3752,10 @@ connection_handle_write_impl(connection_t *conn, int force) if (circ && CIRCUIT_IS_ORIGIN(circ)) { ocirc = TO_ORIGIN_CIRCUIT(circ); - if (PREDICT_LIKELY(UINT32_MAX - ocirc->n_written > n_written)) - ocirc->n_written += (int)n_written; + if (PREDICT_LIKELY(UINT32_MAX - ocirc->n_written_circ_bw > n_written)) + ocirc->n_written_circ_bw += (int)n_written; else - ocirc->n_written = UINT32_MAX; + ocirc->n_written_circ_bw = UINT32_MAX; } } -- cgit v1.2.3