After nickm's review, minor changes to names and comments.
Related to #40194
Signed-off-by: David Goulet <dgoulet@torproject.org>
return -1;
/* Note the RESOLVE stream as seen. */
- rep_hist_note_stream(RELAY_COMMAND_RESOLVE);
+ rep_hist_note_exit_stream(RELAY_COMMAND_RESOLVE);
/* This 'dummy_conn' only exists to remember the stream ID
* associated with the resolve request; and to make the
/* Note the BEGIN stream as seen. We do this after the Exit policy check in
* order to only account for valid streams. */
- rep_hist_note_stream(RELAY_COMMAND_BEGIN);
+ rep_hist_note_exit_stream(RELAY_COMMAND_BEGIN);
#ifdef HAVE_SYS_UN_H
if (conn->socket_family != AF_UNIX) {
log_info(LD_EXIT, "Opening local connection for anonymized directory exit");
/* Note the BEGIN_DIR stream as seen. */
- rep_hist_note_stream(RELAY_COMMAND_BEGIN_DIR);
+ rep_hist_note_exit_stream(RELAY_COMMAND_BEGIN_DIR);
exitconn->base_.state = EXIT_CONN_STATE_OPEN;
{
metrics_store_entry_add_label(sentry,
metrics_format_label("type", relay_command_to_string(cmd)));
- metrics_store_entry_update(sentry, rep_hist_get_stream_seen(cmd));
+ metrics_store_entry_update(sentry, rep_hist_get_exit_stream_seen(cmd));
}
/** Fill function for the RELAY_METRICS_NUM_STREAMS metric. */
log_debug(LD_HIST, "Opened exit stream to port %d", port);
}
-/*** Streams statistics ***/
+/*** Exit streams statistics ***/
/** Number of BEGIN streams seen. */
static uint64_t streams_begin_seen;
/** Note a stream as seen for the given relay command. */
void
-rep_hist_note_stream(unsigned int cmd)
+rep_hist_note_exit_stream(unsigned int cmd)
{
switch (cmd) {
case RELAY_COMMAND_BEGIN:
streams_resolve_seen++;
break;
default:
+ tor_assert_nonfatal_unreached_once();
break;
}
}
/** Return number of stream seen for the given command. */
uint64_t
-rep_hist_get_stream_seen(unsigned int cmd)
+rep_hist_get_exit_stream_seen(unsigned int cmd)
{
switch (cmd) {
case RELAY_COMMAND_BEGIN:
uint64_t rep_hist_get_conn_opened(bool initiated, unsigned int type);
uint64_t rep_hist_get_conn_rejected(unsigned int type);
-void rep_hist_note_stream(unsigned int cmd);
-uint64_t rep_hist_get_stream_seen(unsigned int cmd);
+void rep_hist_note_exit_stream(unsigned int cmd);
+uint64_t rep_hist_get_exit_stream_seen(unsigned int cmd);
void rep_hist_buffer_stats_init(time_t now);
void rep_hist_buffer_stats_add_circ(circuit_t *circ,