aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2013-05-25 13:04:33 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2013-05-25 19:51:38 +0200
commitb33b366a7f8bcab1c9b4859788e3b2c7d3dcf180 (patch)
tree59c39ba18a4ff251e0577d2d073548b9ab8f45b6 /src/or/connection.c
parentef67077fba6061a6e5b9a76caf60a33d17a81ce6 (diff)
downloadtor-b33b366a7f8bcab1c9b4859788e3b2c7d3dcf180.tar
tor-b33b366a7f8bcab1c9b4859788e3b2c7d3dcf180.tar.gz
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.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c14
1 files changed, 7 insertions, 7 deletions
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;
}
}