mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge remote-tracking branch 'public/feature15212_026' into maint-0.2.6
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "connection_or.h"
|
||||
#include "control.h"
|
||||
#include "relay.h"
|
||||
#include "rephist.h"
|
||||
#include "router.h"
|
||||
#include "routerlist.h"
|
||||
#include "scheduler.h"
|
||||
@@ -1463,6 +1464,8 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
return;
|
||||
}
|
||||
|
||||
rep_hist_note_negotiated_link_proto(highest_supported_version, started_here);
|
||||
|
||||
chan->conn->link_proto = highest_supported_version;
|
||||
chan->conn->handshake_state->received_versions = 1;
|
||||
|
||||
|
||||
@@ -1819,6 +1819,7 @@ connection_tls_finish_handshake(or_connection_t *conn)
|
||||
conn->base_.port, digest_rcvd, 0);
|
||||
}
|
||||
tor_tls_block_renegotiation(conn->tls);
|
||||
rep_hist_note_negotiated_link_proto(1, started_here);
|
||||
return connection_or_set_state_open(conn);
|
||||
} else {
|
||||
connection_or_change_state(conn, OR_CONN_STATE_OR_HANDSHAKING_V2);
|
||||
|
||||
@@ -3121,6 +3121,50 @@ rep_hist_hs_stats_write(time_t now)
|
||||
return start_of_hs_stats_interval + WRITE_STATS_INTERVAL;
|
||||
}
|
||||
|
||||
#define MAX_LINK_PROTO_TO_LOG 4
|
||||
static uint64_t link_proto_count[MAX_LINK_PROTO_TO_LOG+1][2];
|
||||
|
||||
/** Note that we negotiated link protocol version <b>link_proto</b>, on
|
||||
* a connection that started here iff <b>started_here</b> is true.
|
||||
*/
|
||||
void
|
||||
rep_hist_note_negotiated_link_proto(unsigned link_proto, int started_here)
|
||||
{
|
||||
started_here = !!started_here; /* force to 0 or 1 */
|
||||
if (link_proto > MAX_LINK_PROTO_TO_LOG) {
|
||||
log_warn(LD_BUG, "Can't log link protocol %u", link_proto);
|
||||
return;
|
||||
}
|
||||
|
||||
link_proto_count[link_proto][started_here]++;
|
||||
}
|
||||
|
||||
/** Log a heartbeat message explaining how many connections of each link
|
||||
* protocol version we have used.
|
||||
*/
|
||||
void
|
||||
rep_hist_log_link_protocol_counts(void)
|
||||
{
|
||||
log_notice(LD_HEARTBEAT,
|
||||
"Since startup, we have initiated "
|
||||
U64_FORMAT" v1 connections, "
|
||||
U64_FORMAT" v2 connections, "
|
||||
U64_FORMAT" v3 connections, and "
|
||||
U64_FORMAT" v4 connections; and received "
|
||||
U64_FORMAT" v1 connections, "
|
||||
U64_FORMAT" v2 connections, "
|
||||
U64_FORMAT" v3 connections, and "
|
||||
U64_FORMAT" v4 connections.",
|
||||
U64_PRINTF_ARG(link_proto_count[1][1]),
|
||||
U64_PRINTF_ARG(link_proto_count[2][1]),
|
||||
U64_PRINTF_ARG(link_proto_count[3][1]),
|
||||
U64_PRINTF_ARG(link_proto_count[4][1]),
|
||||
U64_PRINTF_ARG(link_proto_count[1][0]),
|
||||
U64_PRINTF_ARG(link_proto_count[2][0]),
|
||||
U64_PRINTF_ARG(link_proto_count[3][0]),
|
||||
U64_PRINTF_ARG(link_proto_count[4][0]));
|
||||
}
|
||||
|
||||
/** Free all storage held by the OR/link history caches, by the
|
||||
* bandwidth history arrays, by the port history, or by statistics . */
|
||||
void
|
||||
|
||||
@@ -108,5 +108,9 @@ void rep_hist_stored_maybe_new_hs(const crypto_pk_t *pubkey);
|
||||
|
||||
void rep_hist_free_all(void);
|
||||
|
||||
void rep_hist_note_negotiated_link_proto(unsigned link_proto,
|
||||
int started_here);
|
||||
void rep_hist_log_link_protocol_counts(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+3
-1
@@ -136,8 +136,10 @@ log_heartbeat(time_t now)
|
||||
"Average packaged cell fullness: %2.3f%%. "
|
||||
"TLS write overhead: %.f%%", fullness_pct, overhead_pct);
|
||||
|
||||
if (public_server_mode(options))
|
||||
if (public_server_mode(options)) {
|
||||
rep_hist_log_circuit_handshake_stats(now);
|
||||
rep_hist_log_link_protocol_counts();
|
||||
}
|
||||
|
||||
circuit_log_ancient_one_hop_circuits(1800);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user