summaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2017-02-13 16:57:21 +0000
committerAlexander Færøy <ahf@torproject.org>2017-02-16 15:11:53 +0000
commit3848d236439d476793f03699519a818f26f56c6c (patch)
tree4cd2dcfef5b8b69bbc1cb312177cbcc87866d53e /src/or/relay.c
parent89334a040d6496191e3cee1d69ecd3c0e566583a (diff)
downloadtor-3848d236439d476793f03699519a818f26f56c6c.tar.gz
tor-3848d236439d476793f03699519a818f26f56c6c.zip
Save number of sent/received RELAY_DATA cells for directory connections.
This patch makes us store the number of sent and received RELAY_DATA cells used for directory connections. We log the numbers after we have received an EOF in connection_dir_client_reached_eof() from the directory server.
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 2e76a8ec36..6b3f34f3e5 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -732,6 +732,16 @@ connection_edge_send_command(edge_connection_t *fromconn,
return -1;
}
+#ifdef MEASUREMENTS_21206
+ /* Keep track of the number of RELAY_DATA cells sent for directory
+ * connections. */
+ connection_t *linked_conn = TO_CONN(fromconn)->linked_conn;
+
+ if (linked_conn && linked_conn->type == CONN_TYPE_DIR) {
+ ++(TO_DIR_CONN(linked_conn)->data_cells_sent);
+ }
+#endif
+
return relay_send_command_from_edge(fromconn->stream_id, circ,
relay_command, payload,
payload_len, cpath_layer);
@@ -1585,6 +1595,16 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
connection_write_to_buf((char*)(cell->payload + RELAY_HEADER_SIZE),
rh.length, TO_CONN(conn));
+#ifdef MEASUREMENTS_21206
+ /* Count number of RELAY_DATA cells received on a linked directory
+ * connection. */
+ connection_t *linked_conn = TO_CONN(conn)->linked_conn;
+
+ if (linked_conn && linked_conn->type == CONN_TYPE_DIR) {
+ ++(TO_DIR_CONN(linked_conn)->data_cells_received);
+ }
+#endif
+
if (!optimistic_data) {
/* Only send a SENDME if we're not getting optimistic data; otherwise
* a SENDME could arrive before the CONNECTED.