commit bf91da75abf84a6a61aa92adc5156ba1d5c15998
Author: Roger Dingledine <arma(a)torproject.org>
Date: Wed Feb 7 12:51:05 2018 -0500
remove blank line between function-comment and function
also be more consistent about punctuation in doxygen comments
---
src/or/channel.c | 268 ++++++++++++++++++----------------------------------
src/or/channel.h | 1 -
src/or/channeltls.c | 109 +++++++--------------
3 files changed, 130 insertions(+), 248 deletions(-)
diff --…
[View More]git a/src/or/channel.c b/src/or/channel.c
index f1d3ea6e2..ff1cfde2a 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -52,7 +52,6 @@
* Define this so channel.h gives us things only channel_t subclasses
* should touch.
*/
-
#define TOR_CHANNEL_INTERNAL_
/* This one's for stuff only channel.c and the test suite should see */
@@ -175,9 +174,8 @@ static void channel_listener_force_xfree(channel_listener_t *chan_l);
**********************************/
/**
- * Indicate whether a given channel state is valid
+ * Indicate whether a given channel state is valid.
*/
-
int
channel_state_is_valid(channel_state_t state)
{
@@ -201,9 +199,8 @@ channel_state_is_valid(channel_state_t state)
}
/**
- * Indicate whether a given channel listener state is valid
+ * Indicate whether a given channel listener state is valid.
*/
-
int
channel_listener_state_is_valid(channel_listener_state_t state)
{
@@ -225,13 +222,12 @@ channel_listener_state_is_valid(channel_listener_state_t state)
}
/**
- * Indicate whether a channel state transition is valid
+ * Indicate whether a channel state transition is valid.
*
* This function takes two channel states and indicates whether a
* transition between them is permitted (see the state definitions and
* transition table in or.h at the channel_state_t typedef).
*/
-
int
channel_state_can_transition(channel_state_t from, channel_state_t to)
{
@@ -272,13 +268,12 @@ channel_state_can_transition(channel_state_t from, channel_state_t to)
}
/**
- * Indicate whether a channel listener state transition is valid
+ * Indicate whether a channel listener state transition is valid.
*
* This function takes two channel listener states and indicates whether a
* transition between them is permitted (see the state definitions and
* transition table in or.h at the channel_listener_state_t typedef).
*/
-
int
channel_listener_state_can_transition(channel_listener_state_t from,
channel_listener_state_t to)
@@ -309,9 +304,8 @@ channel_listener_state_can_transition(channel_listener_state_t from,
}
/**
- * Return a human-readable description for a channel state
+ * Return a human-readable description for a channel state.
*/
-
const char *
channel_state_to_string(channel_state_t state)
{
@@ -345,9 +339,8 @@ channel_state_to_string(channel_state_t state)
}
/**
- * Return a human-readable description for a channel listenier state
+ * Return a human-readable description for a channel listener state.
*/
-
const char *
channel_listener_state_to_string(channel_listener_state_t state)
{
@@ -379,12 +372,11 @@ channel_listener_state_to_string(channel_listener_state_t state)
***************************************/
/**
- * Register a channel
+ * Register a channel.
*
* This function registers a newly created channel in the global lists/maps
* of active channels.
*/
-
void
channel_register(channel_t *chan)
{
@@ -437,12 +429,11 @@ channel_register(channel_t *chan)
}
/**
- * Unregister a channel
+ * Unregister a channel.
*
* This function removes a channel from the global lists and maps and is used
* when freeing a closed/errored channel.
*/
-
void
channel_unregister(channel_t *chan)
{
@@ -477,12 +468,11 @@ channel_unregister(channel_t *chan)
}
/**
- * Register a channel listener
+ * Register a channel listener.
*
- * This function registers a newly created channel listner in the global
+ * This function registers a newly created channel listener in the global
* lists/maps of active channel listeners.
*/
-
void
channel_listener_register(channel_listener_t *chan_l)
{
@@ -519,12 +509,11 @@ channel_listener_register(channel_listener_t *chan_l)
}
/**
- * Unregister a channel listener
+ * Unregister a channel listener.
*
* This function removes a channel listener from the global lists and maps
* and is used when freeing a closed/errored channel listener.
*/
-
void
channel_listener_unregister(channel_listener_t *chan_l)
{
@@ -555,13 +544,12 @@ channel_listener_unregister(channel_listener_t *chan_l)
*********************************/
/**
- * Add a channel to the digest map
+ * Add a channel to the digest map.
*
* This function adds a channel to the digest map and inserts it into the
* correct linked list if channels with that remote endpoint identity digest
* already exist.
*/
-
STATIC void
channel_add_to_digest_map(channel_t *chan)
{
@@ -594,12 +582,11 @@ channel_add_to_digest_map(channel_t *chan)
}
/**
- * Remove a channel from the digest map
+ * Remove a channel from the digest map.
*
* This function removes a channel from the digest map and the linked list of
* channels for that digest if more than one exists.
*/
-
static void
channel_remove_from_digest_map(channel_t *chan)
{
@@ -647,13 +634,12 @@ channel_remove_from_digest_map(channel_t *chan)
***************************/
/**
- * Find channel by global ID
+ * Find channel by global ID.
*
* This function searches for a channel by the global_identifier assigned
* at initialization time. This identifier is unique for the lifetime of the
* Tor process.
*/
-
channel_t *
channel_find_by_global_id(uint64_t global_identifier)
{
@@ -691,7 +677,7 @@ channel_remote_identity_matches(const channel_t *chan,
}
/**
- * Find channel by RSA/Ed25519 identity of of the remote endpoint
+ * Find channel by RSA/Ed25519 identity of of the remote endpoint.
*
* This function looks up a channel by the digest of its remote endpoint's RSA
* identity key. If <b>ed_id</b> is provided and nonzero, only a channel
@@ -730,12 +716,11 @@ channel_find_by_remote_identity(const char *rsa_id_digest,
}
/**
- * Get next channel with digest
+ * Get next channel with digest.
*
* This function takes a channel and finds the next channel in the list
* with the same digest.
*/
-
channel_t *
channel_next_with_rsa_identity(channel_t *chan)
{
@@ -822,13 +807,12 @@ channel_check_for_duplicates(void)
}
/**
- * Initialize a channel
+ * Initialize a channel.
*
* This function should be called by subclasses to set up some per-channel
* variables. I.e., this is the superclass constructor. Before this, the
* channel should be allocated with tor_malloc_zero().
*/
-
void
channel_init(channel_t *chan)
{
@@ -860,13 +844,12 @@ channel_init(channel_t *chan)
}
/**
- * Initialize a channel listener
+ * Initialize a channel listener.
*
* This function should be called by subclasses to set up some per-channel
* variables. I.e., this is the superclass constructor. Before this, the
* channel listener should be allocated with tor_malloc_zero().
*/
-
void
channel_init_listener(channel_listener_t *chan_l)
{
@@ -883,7 +866,6 @@ channel_init_listener(channel_listener_t *chan_l)
* Free a channel; nothing outside of channel.c and subclasses should call
* this - it frees channels after they have closed and been unregistered.
*/
-
void
channel_free_(channel_t *chan)
{
@@ -936,7 +918,6 @@ channel_free_(channel_t *chan)
* should call this - it frees channel listeners after they have closed and
* been unregistered.
*/
-
void
channel_listener_free_(channel_listener_t *chan_l)
{
@@ -964,7 +945,6 @@ channel_listener_free_(channel_listener_t *chan_l)
* use-only function should be called only from channel_free_all() when
* shutting down the Tor process.
*/
-
static void
channel_force_xfree(channel_t *chan)
{
@@ -1005,11 +985,10 @@ channel_force_xfree(channel_t *chan)
}
/**
- * Free a channel listener and skip the state/reigstration asserts; this
+ * Free a channel listener and skip the state/registration asserts; this
* internal-use-only function should be called only from channel_free_all()
* when shutting down the Tor process.
*/
-
static void
channel_listener_force_xfree(channel_listener_t *chan_l)
{
@@ -1042,12 +1021,11 @@ channel_listener_force_xfree(channel_listener_t *chan_l)
}
/**
- * Set the listener for a channel listener
+ * Set the listener for a channel listener.
*
* This function sets the handler for new incoming channels on a channel
* listener.
*/
-
void
channel_listener_set_listener_fn(channel_listener_t *chan_l,
channel_listener_fn_ptr listener)
@@ -1066,12 +1044,11 @@ channel_listener_set_listener_fn(channel_listener_t *chan_l,
}
/**
- * Return the fixed-length cell handler for a channel
+ * Return the fixed-length cell handler for a channel.
*
* This function gets the handler for incoming fixed-length cells installed
* on a channel.
*/
-
channel_cell_handler_fn_ptr
channel_get_cell_handler(channel_t *chan)
{
@@ -1084,12 +1061,11 @@ channel_get_cell_handler(channel_t *chan)
}
/**
- * Return the variable-length cell handler for a channel
+ * Return the variable-length cell handler for a channel.
*
* This function gets the handler for incoming variable-length cells
* installed on a channel.
*/
-
channel_var_cell_handler_fn_ptr
channel_get_var_cell_handler(channel_t *chan)
{
@@ -1102,12 +1078,11 @@ channel_get_var_cell_handler(channel_t *chan)
}
/**
- * Set both cell handlers for a channel
+ * Set both cell handlers for a channel.
*
* This function sets both the fixed-length and variable length cell handlers
* for a channel.
*/
-
void
channel_set_cell_handlers(channel_t *chan,
channel_cell_handler_fn_ptr cell_handler,
@@ -1143,13 +1118,12 @@ channel_set_cell_handlers(channel_t *chan,
*/
/**
- * Mark a channel for closure
+ * Mark a channel for closure.
*
* This function tries to close a channel_t; it will go into the CLOSING
* state, and eventually the lower layer should put it into the CLOSED or
* ERROR state. Then, channel_run_cleanup() will eventually free it.
*/
-
void
channel_mark_for_close(channel_t *chan)
{
@@ -1183,13 +1157,12 @@ channel_mark_for_close(channel_t *chan)
}
/**
- * Mark a channel listener for closure
+ * Mark a channel listener for closure.
*
* This function tries to close a channel_listener_t; it will go into the
* CLOSING state, and eventually the lower layer should put it into the CLOSED
* or ERROR state. Then, channel_run_cleanup() will eventually free it.
*/
-
void
channel_listener_mark_for_close(channel_listener_t *chan_l)
{
@@ -1224,13 +1197,12 @@ channel_listener_mark_for_close(channel_listener_t *chan_l)
}
/**
- * Close a channel from the lower layer
+ * Close a channel from the lower layer.
*
* Notify the channel code that the channel is being closed due to a non-error
* condition in the lower layer. This does not call the close() method, since
* the lower layer already knows.
*/
-
void
channel_close_from_lower_layer(channel_t *chan)
{
@@ -1253,13 +1225,12 @@ channel_close_from_lower_layer(channel_t *chan)
}
/**
- * Notify that the channel is being closed due to an error condition
+ * Notify that the channel is being closed due to an error condition.
*
* This function is called by the lower layer implementing the transport
* when a channel must be closed due to an error condition. This does not
* call the channel's close method, since the lower layer already knows.
*/
-
void
channel_close_for_error(channel_t *chan)
{
@@ -1281,13 +1252,12 @@ channel_close_for_error(channel_t *chan)
}
/**
- * Notify that the lower layer is finished closing the channel
+ * Notify that the lower layer is finished closing the channel.
*
* This function should be called by the lower layer when a channel
* is finished closing and it should be regarded as inactive and
* freed by the channel code.
*/
-
void
channel_closed(channel_t *chan)
{
@@ -1314,12 +1284,11 @@ channel_closed(channel_t *chan)
}
/**
- * Clear the identity_digest of a channel
+ * Clear the identity_digest of a channel.
*
* This function clears the identity digest of the remote endpoint for a
* channel; this is intended for use by the lower layer.
*/
-
void
channel_clear_identity_digest(channel_t *chan)
{
@@ -1344,7 +1313,7 @@ channel_clear_identity_digest(channel_t *chan)
}
/**
- * Set the identity_digest of a channel
+ * Set the identity_digest of a channel.
*
* This function sets the identity digest of the remote endpoint for a
* channel; this is intended for use by the lower layer.
@@ -1403,12 +1372,11 @@ channel_set_identity_digest(channel_t *chan,
}
/**
- * Clear the remote end metadata (identity_digest) of a channel
+ * Clear the remote end metadata (identity_digest) of a channel.
*
* This function clears all the remote end info from a channel; this is
* intended for use by the lower layer.
*/
-
void
channel_clear_remote_end(channel_t *chan)
{
@@ -1483,7 +1451,7 @@ write_packed_cell(channel_t *chan, packed_cell_t *cell)
}
/**
- * Write a packed cell to a channel
+ * Write a packed cell to a channel.
*
* Write a packed cell to a channel using the write_cell() method. This is
* called by the transport-independent code to deliver a packed cell to a
@@ -1521,13 +1489,12 @@ channel_write_packed_cell(channel_t *chan, packed_cell_t *cell)
}
/**
- * Change channel state
+ * Change channel state.
*
* This internal and subclass use only function is used to change channel
* state, performing all transition validity checks and whatever actions
* are appropriate to the state transition in question.
*/
-
static void
channel_change_state_(channel_t *chan, channel_state_t to_state)
{
@@ -1641,13 +1608,12 @@ channel_change_state_open(channel_t *chan)
}
/**
- * Change channel listener state
+ * Change channel listener state.
*
* This internal and subclass use only function is used to change channel
* listener state, performing all transition validity checks and whatever
* actions are appropriate to the state transition in question.
*/
-
void
channel_listener_change_state(channel_listener_t *chan_l,
channel_listener_state_t to_state)
@@ -1720,7 +1686,8 @@ channel_listener_change_state(channel_listener_t *chan_l,
* channel_flush_some_cells(). */
#define MAX_CELLS_TO_GET_FROM_CIRCUITS_FOR_UNLIMITED 256
-/* Try to flush cells of the given channel chan up to a maximum of num_cells.
+/**
+ * Try to flush cells of the given channel chan up to a maximum of num_cells.
*
* This is called by the scheduler when it wants to flush cells from the
* channel's circuit queue(s) to the connection outbuf (not yet on the wire).
@@ -1775,7 +1742,7 @@ channel_flush_some_cells, (channel_t *chan, ssize_t num_cells))
}
/**
- * Check if any cells are available
+ * Check if any cells are available.
*
* This is used by the scheduler to know if the channel has more to flush
* after a scheduling round.
@@ -1792,12 +1759,11 @@ channel_more_to_flush, (channel_t *chan))
}
/**
- * Notify the channel we're done flushing the output in the lower layer
+ * Notify the channel we're done flushing the output in the lower layer.
*
* Connection.c will call this when we've flushed the output; there's some
* dirreq-related maintenance to do.
*/
-
void
channel_notify_flushed(channel_t *chan)
{
@@ -1810,12 +1776,11 @@ channel_notify_flushed(channel_t *chan)
}
/**
- * Process the queue of incoming channels on a listener
+ * Process the queue of incoming channels on a listener.
*
* Use a listener's registered callback to process as many entries in the
* queue of incoming channels as possible.
*/
-
void
channel_listener_process_incoming(channel_listener_t *listener)
{
@@ -1857,7 +1822,7 @@ channel_listener_process_incoming(channel_listener_t *listener)
}
/**
- * Take actions required when a channel becomes open
+ * Take actions required when a channel becomes open.
*
* Handle actions we should do when we know a channel is open; a lot of
* this comes from the old connection_or_set_state_open() of connection_or.c.
@@ -1935,13 +1900,12 @@ channel_do_open_actions(channel_t *chan)
}
/**
- * Queue an incoming channel on a listener
+ * Queue an incoming channel on a listener.
*
* Internal and subclass use only function to queue an incoming channel from
* a listener. A subclass of channel_listener_t should call this when a new
* incoming channel is created.
*/
-
void
channel_listener_queue_incoming(channel_listener_t *listener,
channel_t *incoming)
@@ -2042,13 +2006,12 @@ packed_cell_is_destroy(channel_t *chan,
}
/**
- * Send destroy cell on a channel
+ * Send destroy cell on a channel.
*
* Write a destroy cell with circ ID <b>circ_id</b> and reason <b>reason</b>
* onto channel <b>chan</b>. Don't perform range-checking on reason:
* we may want to propagate reasons from other cells.
*/
-
int
channel_send_destroy(circid_t circ_id, channel_t *chan, int reason)
{
@@ -2084,12 +2047,11 @@ channel_send_destroy(circid_t circ_id, channel_t *chan, int reason)
}
/**
- * Dump channel statistics to the log
+ * Dump channel statistics to the log.
*
* This is called from dumpstats() in main.c and spams the log with
* statistics on channels.
*/
-
void
channel_dumpstats(int severity)
{
@@ -2116,12 +2078,11 @@ channel_dumpstats(int severity)
}
/**
- * Dump channel listener statistics to the log
+ * Dump channel listener statistics to the log.
*
* This is called from dumpstats() in main.c and spams the log with
* statistics on channel listeners.
*/
-
void
channel_listener_dumpstats(int severity)
{
@@ -2148,9 +2109,8 @@ channel_listener_dumpstats(int severity)
}
/**
- * Set the cmux policy on all active channels
+ * Set the cmux policy on all active channels.
*/
-
void
channel_set_cmux_policy_everywhere(circuitmux_policy_t *pol)
{
@@ -2164,12 +2124,11 @@ channel_set_cmux_policy_everywhere(circuitmux_policy_t *pol)
}
/**
- * Clean up channels
+ * Clean up channels.
*
* This gets called periodically from run_scheduled_events() in main.c;
* it cleans up after closed channels.
*/
-
void
channel_run_cleanup(void)
{
@@ -2191,12 +2150,11 @@ channel_run_cleanup(void)
}
/**
- * Clean up channel listeners
+ * Clean up channel listeners.
*
* This gets called periodically from run_scheduled_events() in main.c;
* it cleans up after closed channel listeners.
*/
-
void
channel_listener_run_cleanup(void)
{
@@ -2218,9 +2176,8 @@ channel_listener_run_cleanup(void)
}
/**
- * Free a list of channels for channel_free_all()
+ * Free a list of channels for channel_free_all().
*/
-
static void
channel_free_list(smartlist_t *channels, int mark_for_close)
{
@@ -2250,9 +2207,8 @@ channel_free_list(smartlist_t *channels, int mark_for_close)
}
/**
- * Free a list of channel listeners for channel_free_all()
+ * Free a list of channel listeners for channel_free_all().
*/
-
static void
channel_listener_free_list(smartlist_t *listeners, int mark_for_close)
{
@@ -2279,14 +2235,13 @@ channel_listener_free_list(smartlist_t *listeners, int mark_for_close)
}
/**
- * Close all channels and free everything
+ * Close all channels and free everything.
*
* This gets called from tor_free_all() in main.c to clean up on exit.
* It will close all registered channels and free associated storage,
* then free the all_channels, active_channels, listening_channels and
* finished_channels lists and also channel_identity_map.
*/
-
void
channel_free_all(void)
{
@@ -2351,7 +2306,7 @@ channel_free_all(void)
}
/**
- * Connect to a given addr/port/digest
+ * Connect to a given addr/port/digest.
*
* This sets up a new outgoing channel; in the future if multiple
* channel_t subclasses are available, this is where the selection policy
@@ -2360,7 +2315,6 @@ channel_free_all(void)
* single abstract object encapsulating all the protocol details of
* how to contact an OR.
*/
-
channel_t *
channel_connect(const tor_addr_t *addr, uint16_t port,
const char *id_digest,
@@ -2370,7 +2324,7 @@ channel_connect(const tor_addr_t *addr, uint16_t port,
}
/**
- * Decide which of two channels to prefer for extending a circuit
+ * Decide which of two channels to prefer for extending a circuit.
*
* This function is called while extending a circuit and returns true iff
* a is 'better' than b. The most important criterion here is that a
@@ -2379,7 +2333,6 @@ channel_connect(const tor_addr_t *addr, uint16_t port,
*
* This is based on the former connection_or_is_better() of connection_or.c
*/
-
int
channel_is_better(channel_t *a, channel_t *b)
{
@@ -2431,7 +2384,7 @@ channel_is_better(channel_t *a, channel_t *b)
}
/**
- * Get a channel to extend a circuit
+ * Get a channel to extend a circuit.
*
* Pick a suitable channel to extend a circuit to given the desired digest
* the address we believe is correct for that digest; this tries to see
@@ -2440,7 +2393,6 @@ channel_is_better(channel_t *a, channel_t *b)
* and our next action, and set *launch_out to a boolean indicated whether
* the caller should try to launch a new channel with channel_connect().
*/
-
channel_t *
channel_get_for_extend(const char *rsa_id_digest,
const ed25519_public_key_t *ed_id,
@@ -2545,12 +2497,11 @@ channel_get_for_extend(const char *rsa_id_digest,
}
/**
- * Describe the transport subclass for a channel
+ * Describe the transport subclass for a channel.
*
* Invoke a method to get a string description of the lower-layer
* transport for this channel.
*/
-
const char *
channel_describe_transport(channel_t *chan)
{
@@ -2561,12 +2512,11 @@ channel_describe_transport(channel_t *chan)
}
/**
- * Describe the transport subclass for a channel listener
+ * Describe the transport subclass for a channel listener.
*
* Invoke a method to get a string description of the lower-layer
* transport for this channel listener.
*/
-
const char *
channel_listener_describe_transport(channel_listener_t *chan_l)
{
@@ -2577,11 +2527,10 @@ channel_listener_describe_transport(channel_listener_t *chan_l)
}
/**
- * Dump channel statistics
+ * Dump channel statistics.
*
- * Dump statistics for one channel to the log
+ * Dump statistics for one channel to the log.
*/
-
MOCK_IMPL(void,
channel_dump_statistics, (channel_t *chan, int severity))
{
@@ -2764,11 +2713,10 @@ channel_dump_statistics, (channel_t *chan, int severity))
}
/**
- * Dump channel listener statistics
+ * Dump channel listener statistics.
*
- * Dump statistics for one channel listener to the log
+ * Dump statistics for one channel listener to the log.
*/
-
void
channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
{
@@ -2831,11 +2779,10 @@ channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
}
/**
- * Invoke transport-specific stats dump for channel
+ * Invoke transport-specific stats dump for channel.
*
- * If there is a lower-layer statistics dump method, invoke it
+ * If there is a lower-layer statistics dump method, invoke it.
*/
-
void
channel_dump_transport_statistics(channel_t *chan, int severity)
{
@@ -2845,11 +2792,10 @@ channel_dump_transport_statistics(channel_t *chan, int severity)
}
/**
- * Invoke transport-specific stats dump for channel listener
+ * Invoke transport-specific stats dump for channel listener.
*
- * If there is a lower-layer statistics dump method, invoke it
+ * If there is a lower-layer statistics dump method, invoke it.
*/
-
void
channel_listener_dump_transport_statistics(channel_listener_t *chan_l,
int severity)
@@ -2860,7 +2806,7 @@ channel_listener_dump_transport_statistics(channel_listener_t *chan_l,
}
/**
- * Return text description of the remote endpoint
+ * Return text description of the remote endpoint.
*
* This function return a test provided by the lower layer of the remote
* endpoint for this channel; it should specify the actual address connected
@@ -2893,7 +2839,7 @@ channel_get_actual_remote_address(channel_t *chan)
}
/**
- * Return text description of the remote endpoint canonical address
+ * Return text description of the remote endpoint canonical address.
*
* This function return a test provided by the lower layer of the remote
* endpoint for this channel; it should use the known canonical address for
@@ -2931,7 +2877,7 @@ channel_get_addr_if_possible,(channel_t *chan, tor_addr_t *addr_out))
else return 0;
}
-/*
+/**
* Return true iff the channel has any cells on the connection outbuf waiting
* to be sent onto the network.
*/
@@ -2946,12 +2892,11 @@ channel_has_queued_writes(channel_t *chan)
}
/**
- * Check the is_bad_for_new_circs flag
+ * Check the is_bad_for_new_circs flag.
*
* This function returns the is_bad_for_new_circs flag of the specified
* channel.
*/
-
int
channel_is_bad_for_new_circs(channel_t *chan)
{
@@ -2961,11 +2906,10 @@ channel_is_bad_for_new_circs(channel_t *chan)
}
/**
- * Mark a channel as bad for new circuits
+ * Mark a channel as bad for new circuits.
*
* Set the is_bad_for_new_circs_flag on chan.
*/
-
void
channel_mark_bad_for_new_circs(channel_t *chan)
{
@@ -2975,13 +2919,12 @@ channel_mark_bad_for_new_circs(channel_t *chan)
}
/**
- * Get the client flag
+ * Get the client flag.
*
* This returns the client flag of a channel, which will be set if
* command_process_create_cell() in command.c thinks this is a connection
* from a client.
*/
-
int
channel_is_client(const channel_t *chan)
{
@@ -2991,11 +2934,10 @@ channel_is_client(const channel_t *chan)
}
/**
- * Set the client flag
+ * Set the client flag.
*
- * Mark a channel as being from a client
+ * Mark a channel as being from a client.
*/
-
void
channel_mark_client(channel_t *chan)
{
@@ -3005,11 +2947,10 @@ channel_mark_client(channel_t *chan)
}
/**
- * Clear the client flag
+ * Clear the client flag.
*
- * Mark a channel as being _not_ from a client
+ * Mark a channel as being _not_ from a client.
*/
-
void
channel_clear_client(channel_t *chan)
{
@@ -3019,12 +2960,11 @@ channel_clear_client(channel_t *chan)
}
/**
- * Get the canonical flag for a channel
+ * Get the canonical flag for a channel.
*
* This returns the is_canonical for a channel; this flag is determined by
* the lower layer and can't be set in a transport-independent way.
*/
-
int
channel_is_canonical(channel_t *chan)
{
@@ -3035,12 +2975,11 @@ channel_is_canonical(channel_t *chan)
}
/**
- * Test if the canonical flag is reliable
+ * Test if the canonical flag is reliable.
*
* This function asks if the lower layer thinks it's safe to trust the
- * result of channel_is_canonical()
+ * result of channel_is_canonical().
*/
-
int
channel_is_canonical_is_reliable(channel_t *chan)
{
@@ -3051,12 +2990,11 @@ channel_is_canonical_is_reliable(channel_t *chan)
}
/**
- * Test incoming flag
+ * Test incoming flag.
*
* This function gets the incoming flag; this is set when a listener spawns
* a channel. If this returns true the channel was remotely initiated.
*/
-
int
channel_is_incoming(channel_t *chan)
{
@@ -3066,12 +3004,11 @@ channel_is_incoming(channel_t *chan)
}
/**
- * Set the incoming flag
+ * Set the incoming flag.
*
* This function is called when a channel arrives on a listening channel
* to mark it as incoming.
*/
-
void
channel_mark_incoming(channel_t *chan)
{
@@ -3081,7 +3018,7 @@ channel_mark_incoming(channel_t *chan)
}
/**
- * Test local flag
+ * Test local flag.
*
* This function gets the local flag; the lower layer should set this when
* setting up the channel if is_local_addr() is true for all of the
@@ -3089,7 +3026,6 @@ channel_mark_incoming(channel_t *chan)
* used to decide whether to declare the network reachable when seeing incoming
* traffic on the channel.
*/
-
int
channel_is_local(channel_t *chan)
{
@@ -3099,13 +3035,12 @@ channel_is_local(channel_t *chan)
}
/**
- * Set the local flag
+ * Set the local flag.
*
* This internal-only function should be called by the lower layer if the
* channel is to a local address. See channel_is_local() above or the
- * description of the is_local bit in channel.h
+ * description of the is_local bit in channel.h.
*/
-
void
channel_mark_local(channel_t *chan)
{
@@ -3115,14 +3050,13 @@ channel_mark_local(channel_t *chan)
}
/**
- * Mark a channel as remote
+ * Mark a channel as remote.
*
* This internal-only function should be called by the lower layer if the
* channel is not to a local address but has previously been marked local.
* See channel_is_local() above or the description of the is_local bit in
* channel.h
*/
-
void
channel_mark_remote(channel_t *chan)
{
@@ -3132,13 +3066,12 @@ channel_mark_remote(channel_t *chan)
}
/**
- * Test outgoing flag
+ * Test outgoing flag.
*
* This function gets the outgoing flag; this is the inverse of the incoming
* bit set when a listener spawns a channel. If this returns true the channel
* was locally initiated.
*/
-
int
channel_is_outgoing(channel_t *chan)
{
@@ -3148,12 +3081,11 @@ channel_is_outgoing(channel_t *chan)
}
/**
- * Mark a channel as outgoing
+ * Mark a channel as outgoing.
*
* This function clears the incoming flag and thus marks a channel as
* outgoing.
*/
-
void
channel_mark_outgoing(channel_t *chan)
{
@@ -3166,8 +3098,8 @@ channel_mark_outgoing(channel_t *chan)
* Flow control queries *
***********************/
-/*
- * Estimate the number of writeable cells
+/**
+ * Estimate the number of writeable cells.
*
* Ask the lower layer for an estimate of how many cells it can accept.
*/
@@ -3201,7 +3133,6 @@ channel_num_cells_writeable(channel_t *chan)
* This updates the channel's created timestamp and should only be called
* from channel_init().
*/
-
void
channel_timestamp_created(channel_t *chan)
{
@@ -3218,7 +3149,6 @@ channel_timestamp_created(channel_t *chan)
* This updates the channel listener's created timestamp and should only be
* called from channel_init_listener().
*/
-
void
channel_listener_timestamp_created(channel_listener_t *chan_l)
{
@@ -3239,7 +3169,6 @@ channel_listener_timestamp_created(channel_listener_t *chan_l)
* but it should be updated for things like the v3 handshake and stuff that
* produce activity only visible to the lower layer.
*/
-
void
channel_timestamp_active(channel_t *chan)
{
@@ -3286,12 +3215,11 @@ channel_listener_timestamp_accepted(channel_listener_t *chan_l)
}
/**
- * Update client timestamp
+ * Update client timestamp.
*
* This function is called by relay.c to timestamp a channel that appears to
* be used as a client.
*/
-
void
channel_timestamp_client(channel_t *chan)
{
@@ -3308,7 +3236,6 @@ channel_timestamp_client(channel_t *chan)
* This is called whenever we get an incoming cell from the lower layer.
* This also updates the active timestamp.
*/
-
void
channel_timestamp_recv(channel_t *chan)
{
@@ -3329,7 +3256,6 @@ channel_timestamp_recv(channel_t *chan)
* This is called whenever we pass an outgoing cell to the lower layer. This
* also updates the active timestamp.
*/
-
void
channel_timestamp_xmit(channel_t *chan)
{
@@ -3350,9 +3276,8 @@ channel_timestamp_xmit(channel_t *chan)
**************************************************************/
/**
- * Query created timestamp for a channel
+ * Query created timestamp for a channel.
*/
-
time_t
channel_when_created(channel_t *chan)
{
@@ -3362,9 +3287,8 @@ channel_when_created(channel_t *chan)
}
/**
- * Query client timestamp
+ * Query client timestamp.
*/
-
time_t
channel_when_last_client(channel_t *chan)
{
@@ -3374,9 +3298,8 @@ channel_when_last_client(channel_t *chan)
}
/**
- * Query xmit timestamp
+ * Query xmit timestamp.
*/
-
time_t
channel_when_last_xmit(channel_t *chan)
{
@@ -3386,12 +3309,11 @@ channel_when_last_xmit(channel_t *chan)
}
/**
- * Check if a channel matches an extend_info_t
+ * Check if a channel matches an extend_info_t.
*
* This function calls the lower layer and asks if this channel matches a
* given extend_info_t.
*/
-
int
channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info)
{
@@ -3408,7 +3330,6 @@ channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info)
* This function calls into the lower layer and asks if this channel thinks
* it matches a given target address for circuit extension purposes.
*/
-
int
channel_matches_target_addr_for_extend(channel_t *chan,
const tor_addr_t *target)
@@ -3421,12 +3342,11 @@ channel_matches_target_addr_for_extend(channel_t *chan,
}
/**
- * Return the total number of circuits used by a channel
+ * Return the total number of circuits used by a channel.
*
* @param chan Channel to query
* @return Number of circuits using this as n_chan or p_chan
*/
-
unsigned int
channel_num_circuits(channel_t *chan)
{
@@ -3437,10 +3357,10 @@ channel_num_circuits(channel_t *chan)
}
/**
- * Set up circuit ID generation
+ * Set up circuit ID generation.
*
* This is called when setting up a channel and replaces the old
- * connection_or_set_circid_type()
+ * connection_or_set_circid_type().
*/
MOCK_IMPL(void,
channel_set_circid_type,(channel_t *chan,
diff --git a/src/or/channel.h b/src/or/channel.h
index 9128403ce..0af5aed41 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -38,7 +38,6 @@ typedef enum {
* to a particular node, and once constructed support the abstract operations
* defined below.
*/
-
struct channel_s {
/** Magic number for type-checking cast macros */
uint32_t magic;
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 2302c194b..9000703b0 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -34,7 +34,6 @@
* Define this so channel.h gives us things only channel_t subclasses
* should touch.
*/
-
#define TOR_CHANNEL_INTERNAL_
#define CHANNELTLS_PRIVATE
@@ -132,7 +131,6 @@ static void channel_tls_process_padding_negotiate_cell(cell_t *cell,
* Do parts of channel_tls_t initialization common to channel_tls_connect()
* and channel_tls_handle_incoming().
*/
-
STATIC void
channel_tls_common_init(channel_tls_t *tlschan)
{
@@ -168,13 +166,12 @@ channel_tls_common_init(channel_tls_t *tlschan)
}
/**
- * Start a new TLS channel
+ * Start a new TLS channel.
*
* Launch a new OR connection to <b>addr</b>:<b>port</b> and expect to
* handshake with an OR with identity digest <b>id_digest</b>, and wrap
* it in a channel_tls_t.
*/
-
channel_t *
channel_tls_connect(const tor_addr_t *addr, uint16_t port,
const char *id_digest,
@@ -233,12 +230,11 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
}
/**
- * Return the current channel_tls_t listener
+ * Return the current channel_tls_t listener.
*
* Returns the current channel listener for incoming TLS connections, or
* NULL if none has been established
*/
-
channel_listener_t *
channel_tls_get_listener(void)
{
@@ -246,12 +242,11 @@ channel_tls_get_listener(void)
}
/**
- * Start a channel_tls_t listener if necessary
+ * Start a channel_tls_t listener if necessary.
*
* Return the current channel_tls_t listener, or start one if we haven't yet,
* and return that.
*/
-
channel_listener_t *
channel_tls_start_listener(void)
{
@@ -278,12 +273,11 @@ channel_tls_start_listener(void)
}
/**
- * Free everything on shutdown
+ * Free everything on shutdown.
*
* Not much to do here, since channel_free_all() takes care of a lot, but let's
* get rid of the listener.
*/
-
void
channel_tls_free_all(void)
{
@@ -314,9 +308,8 @@ channel_tls_free_all(void)
}
/**
- * Create a new channel around an incoming or_connection_t
+ * Create a new channel around an incoming or_connection_t.
*/
-
channel_t *
channel_tls_handle_incoming(or_connection_t *orconn)
{
@@ -359,7 +352,6 @@ channel_tls_handle_incoming(or_connection_t *orconn)
/**
* Cast a channel_tls_t to a channel_t.
*/
-
channel_t *
channel_tls_to_base(channel_tls_t *tlschan)
{
@@ -372,7 +364,6 @@ channel_tls_to_base(channel_tls_t *tlschan)
* Cast a channel_t to a channel_tls_t, with appropriate type-checking
* asserts.
*/
-
channel_tls_t *
channel_tls_from_base(channel_t *chan)
{
@@ -388,11 +379,10 @@ channel_tls_from_base(channel_t *chan)
*******************************************/
/**
- * Close a channel_tls_t
+ * Close a channel_tls_t.
*
- * This implements the close method for channel_tls_t
+ * This implements the close method for channel_tls_t.
*/
-
static void
channel_tls_close_method(channel_t *chan)
{
@@ -411,12 +401,11 @@ channel_tls_close_method(channel_t *chan)
}
/**
- * Describe the transport for a channel_tls_t
+ * Describe the transport for a channel_tls_t.
*
* This returns the string "TLS channel on connection <id>" to the upper
* layer.
*/
-
static const char *
channel_tls_describe_transport_method(channel_t *chan)
{
@@ -446,7 +435,7 @@ channel_tls_describe_transport_method(channel_t *chan)
}
/**
- * Free a channel_tls_t
+ * Free a channel_tls_t.
*
* This is called by the generic channel layer when freeing a channel_tls_t;
* this happens either on a channel which has already reached
@@ -455,7 +444,6 @@ channel_tls_describe_transport_method(channel_t *chan)
* have an orconn active (which connection_free_all() will get to later),
* so we should null out its channel pointer now.
*/
-
static void
channel_tls_free_method(channel_t *chan)
{
@@ -470,9 +458,8 @@ channel_tls_free_method(channel_t *chan)
}
/**
- * Get an estimate of the average TLS overhead for the upper layer
+ * Get an estimate of the average TLS overhead for the upper layer.
*/
-
static double
channel_tls_get_overhead_estimate_method(channel_t *chan)
{
@@ -505,13 +492,12 @@ channel_tls_get_overhead_estimate_method(channel_t *chan)
}
/**
- * Get the remote address of a channel_tls_t
+ * Get the remote address of a channel_tls_t.
*
* This implements the get_remote_addr method for channel_tls_t; copy the
* remote endpoint of the channel to addr_out and return 1 (always
* succeeds for this transport).
*/
-
static int
channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out)
{
@@ -535,8 +521,8 @@ channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out)
* This implements the get_transport_name for channel_tls_t. If the
* channel uses a pluggable transport, copy its name to
* <b>transport_out</b> and return 0. If the channel did not use a
- * pluggable transport, return -1. */
-
+ * pluggable transport, return -1.
+ */
static int
channel_tls_get_transport_name_method(channel_t *chan, char **transport_out)
{
@@ -554,14 +540,13 @@ channel_tls_get_transport_name_method(channel_t *chan, char **transport_out)
}
/**
- * Get endpoint description of a channel_tls_t
+ * Get endpoint description of a channel_tls_t.
*
* This implements the get_remote_descr method for channel_tls_t; it returns
* a text description of the remote endpoint of the channel suitable for use
- * in log messages. The req parameter is 0 for the canonical address or 1 for
+ * in log messages. The req parameter is 0 for the canonical address or 1 for
* the actual address seen.
*/
-
static const char *
channel_tls_get_remote_descr_method(channel_t *chan, int flags)
{
@@ -617,12 +602,11 @@ channel_tls_get_remote_descr_method(channel_t *chan, int flags)
}
/**
- * Tell the upper layer if we have queued writes
+ * Tell the upper layer if we have queued writes.
*
* This implements the has_queued_writes method for channel_tls t_; it returns
* 1 iff we have queued writes on the outbuf of the underlying or_connection_t.
*/
-
static int
channel_tls_has_queued_writes_method(channel_t *chan)
{
@@ -645,13 +629,12 @@ channel_tls_has_queued_writes_method(channel_t *chan)
}
/**
- * Tell the upper layer if we're canonical
+ * Tell the upper layer if we're canonical.
*
* This implements the is_canonical method for channel_tls_t; if req is zero,
* it returns whether this is a canonical channel, and if it is one it returns
* whether that can be relied upon.
*/
-
static int
channel_tls_is_canonical_method(channel_t *chan, int req)
{
@@ -684,12 +667,11 @@ channel_tls_is_canonical_method(channel_t *chan, int req)
}
/**
- * Check if we match an extend_info_t
+ * Check if we match an extend_info_t.
*
* This implements the matches_extend_info method for channel_tls_t; the upper
* layer wants to know if this channel matches an extend_info_t.
*/
-
static int
channel_tls_matches_extend_info_method(channel_t *chan,
extend_info_t *extend_info)
@@ -720,7 +702,6 @@ channel_tls_matches_extend_info_method(channel_t *chan,
* layer wants to know if this channel matches a target address when extending
* a circuit.
*/
-
static int
channel_tls_matches_target_method(channel_t *chan,
const tor_addr_t *target)
@@ -755,7 +736,6 @@ channel_tls_matches_target_method(channel_t *chan,
* Tell the upper layer how many bytes we have queued and not yet
* sent.
*/
-
static size_t
channel_tls_num_bytes_queued_method(channel_t *chan)
{
@@ -768,13 +748,12 @@ channel_tls_num_bytes_queued_method(channel_t *chan)
}
/**
- * Tell the upper layer how many cells we can accept to write
+ * Tell the upper layer how many cells we can accept to write.
*
* This implements the num_cells_writeable method for channel_tls_t; it
* returns an estimate of the number of cells we can accept with
* channel_tls_write_*_cell().
*/
-
static int
channel_tls_num_cells_writeable_method(channel_t *chan)
{
@@ -799,12 +778,11 @@ channel_tls_num_cells_writeable_method(channel_t *chan)
}
/**
- * Write a cell to a channel_tls_t
+ * Write a cell to a channel_tls_t.
*
* This implements the write_cell method for channel_tls_t; given a
* channel_tls_t and a cell_t, transmit the cell_t.
*/
-
static int
channel_tls_write_cell_method(channel_t *chan, cell_t *cell)
{
@@ -828,7 +806,7 @@ channel_tls_write_cell_method(channel_t *chan, cell_t *cell)
}
/**
- * Write a packed cell to a channel_tls_t
+ * Write a packed cell to a channel_tls_t.
*
* This implements the write_packed_cell method for channel_tls_t; given a
* channel_tls_t and a packed_cell_t, transmit the packed_cell_t.
@@ -836,7 +814,6 @@ channel_tls_write_cell_method(channel_t *chan, cell_t *cell)
* Return 0 on success or negative value on error. The caller must free the
* packed cell.
*/
-
static int
channel_tls_write_packed_cell_method(channel_t *chan,
packed_cell_t *packed_cell)
@@ -863,12 +840,11 @@ channel_tls_write_packed_cell_method(channel_t *chan,
}
/**
- * Write a variable-length cell to a channel_tls_t
+ * Write a variable-length cell to a channel_tls_t.
*
* This implements the write_var_cell method for channel_tls_t; given a
* channel_tls_t and a var_cell_t, transmit the var_cell_t.
*/
-
static int
channel_tls_write_var_cell_method(channel_t *chan, var_cell_t *var_cell)
{
@@ -896,11 +872,10 @@ channel_tls_write_var_cell_method(channel_t *chan, var_cell_t *var_cell)
************************************************/
/**
- * Close a channel_listener_t
+ * Close a channel_listener_t.
*
- * This implements the close method for channel_listener_t
+ * This implements the close method for channel_listener_t.
*/
-
static void
channel_tls_listener_close_method(channel_listener_t *chan_l)
{
@@ -936,12 +911,11 @@ channel_tls_listener_close_method(channel_listener_t *chan_l)
}
/**
- * Describe the transport for a channel_listener_t
+ * Describe the transport for a channel_listener_t.
*
* This returns the string "TLS channel (listening)" to the upper
* layer.
*/
-
static const char *
channel_tls_listener_describe_transport_method(channel_listener_t *chan_l)
{
@@ -955,12 +929,11 @@ channel_tls_listener_describe_transport_method(channel_listener_t *chan_l)
******************************************************/
/**
- * Handle an orconn state change
+ * Handle an orconn state change.
*
* This function will be called by connection_or.c when the or_connection_t
* associated with this channel_tls_t changes state.
*/
-
void
channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
or_connection_t *conn,
@@ -1011,13 +984,12 @@ channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
#ifdef KEEP_TIMING_STATS
/**
- * Timing states wrapper
+ * Timing states wrapper.
*
* This is a wrapper function around the actual function that processes the
* <b>cell</b> that just arrived on <b>chan</b>. Increment <b>*time</b>
* by the number of microseconds used by the call to <b>*func(cell, chan)</b>.
*/
-
static void
channel_tls_time_process_cell(cell_t *cell, channel_tls_t *chan, int *time,
void (*func)(cell_t *, channel_tls_t *))
@@ -1046,7 +1018,7 @@ channel_tls_time_process_cell(cell_t *cell, channel_tls_t *chan, int *time,
#endif /* defined(KEEP_TIMING_STATS) */
/**
- * Handle an incoming cell on a channel_tls_t
+ * Handle an incoming cell on a channel_tls_t.
*
* This is called from connection_or.c to handle an arriving cell; it checks
* for cell types specific to the handshake for this transport protocol and
@@ -1058,7 +1030,6 @@ channel_tls_time_process_cell(cell_t *cell, channel_tls_t *chan, int *time,
* for copying in the case that it queues; we merely pass pointers through
* which we get from connection_or_process_cells_from_inbuf().
*/
-
void
channel_tls_handle_cell(cell_t *cell, or_connection_t *conn)
{
@@ -1160,7 +1131,7 @@ channel_tls_handle_cell(cell_t *cell, or_connection_t *conn)
}
/**
- * Handle an incoming variable-length cell on a channel_tls_t
+ * Handle an incoming variable-length cell on a channel_tls_t.
*
* Process a <b>var_cell</b> that was just received on <b>conn</b>. Keep
* internal statistics about how many of each cell we've processed so far
@@ -1176,7 +1147,6 @@ channel_tls_handle_cell(cell_t *cell, or_connection_t *conn)
* caller always frees them after this function returns, so this function
* should never free var_cell.
*/
-
void
channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
{
@@ -1341,7 +1311,7 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
}
/**
- * Update channel marks after connection_or.c has changed an address
+ * Update channel marks after connection_or.c has changed an address.
*
* This is called from connection_or_init_conn_from_address() after the
* connection's _base.addr or real_addr fields have potentially been changed
@@ -1350,7 +1320,6 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
* remote router by looking it up in the consensus after we finish the
* handshake and know an authenticated identity digest.
*/
-
void
channel_tls_update_marks(or_connection_t *conn)
{
@@ -1379,12 +1348,11 @@ channel_tls_update_marks(or_connection_t *conn)
}
/**
- * Check if this cell type is allowed before the handshake is finished
+ * Check if this cell type is allowed before the handshake is finished.
*
* Return true if <b>command</b> is a cell command that's allowed to start a
* V3 handshake.
*/
-
static int
command_allowed_before_handshake(uint8_t command)
{
@@ -1399,14 +1367,13 @@ command_allowed_before_handshake(uint8_t command)
}
/**
- * Start a V3 handshake on an incoming connection
+ * Start a V3 handshake on an incoming connection.
*
* Called when we as a server receive an appropriate cell while waiting
* either for a cell or a TLS handshake. Set the connection's state to
* "handshaking_v3', initializes the or_handshake_state field as needed,
* and add the cell to the hash of incoming cells.)
*/
-
static int
enter_v3_handshake_with_cell(var_cell_t *cell, channel_tls_t *chan)
{
@@ -1447,7 +1414,6 @@ enter_v3_handshake_with_cell(var_cell_t *cell, channel_tls_t *chan)
* we support, pick the highest version we have in common, and continue the
* negotiation from there.
*/
-
static void
channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
{
@@ -1622,7 +1588,7 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
}
/**
- * Process a 'padding_negotiate' cell
+ * Process a 'padding_negotiate' cell.
*
* This function is called to handle an incoming PADDING_NEGOTIATE cell;
* enable or disable padding accordingly, and read and act on its timeout
@@ -1659,12 +1625,11 @@ channel_tls_process_padding_negotiate_cell(cell_t *cell, channel_tls_t *chan)
}
/**
- * Process a 'netinfo' cell
+ * Process a 'netinfo' cell.
*
* This function is called to handle an incoming NETINFO cell; read and act
* on its contents, and set the connection state to "open".
*/
-
static void
channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
{
@@ -2167,7 +2132,7 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
}
/**
- * Process an AUTH_CHALLENGE cell from a channel_tls_t
+ * Process an AUTH_CHALLENGE cell from a channel_tls_t.
*
* This function is called to handle an incoming AUTH_CHALLENGE cell on a
* channel_tls_t; if we weren't supposed to get one (for example, because we're
@@ -2176,7 +2141,6 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
* want to authenticate, just drop it. If the cell is well-formed *and* we
* want to authenticate, send an AUTHENTICATE cell and then a NETINFO cell.
*/
-
STATIC void
channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
{
@@ -2270,7 +2234,7 @@ channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
}
/**
- * Process an AUTHENTICATE cell from a channel_tls_t
+ * Process an AUTHENTICATE cell from a channel_tls_t.
*
* If it's ill-formed or we weren't supposed to get one or we're not doing a
* v3 handshake, then mark the connection. If it does not authenticate the
@@ -2278,7 +2242,6 @@ channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
* we didn't get a CERTS cell, etc) mark the connection. Otherwise, accept
* the identity of the router on the other side of the connection.
*/
-
STATIC void
channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
{
[View Less]
commit 93ebcc2b8f8f22f2628cf74cc92674c8fbeb7b9a
Author: David Goulet <dgoulet(a)torproject.org>
Date: Tue Feb 6 12:51:43 2018 -0500
rephist: Stop tracking relay connection status
Remove a series of connection counters that were only used when dumping the
rephist statistics with SIGUSR1 signal.
This reduces the or_history_t structure size.
Closes #25163
Signed-off-by: David Goulet <dgoulet(a)torproject.org>
---
changes/ticket25163 | …
[View More] 4 ++
src/or/channel.c | 1 -
src/or/connection_or.c | 4 --
src/or/rephist.c | 140 +------------------------------------------------
src/or/rephist.h | 4 --
5 files changed, 5 insertions(+), 148 deletions(-)
diff --git a/changes/ticket25163 b/changes/ticket25163
new file mode 100644
index 000000000..6d237db75
--- /dev/null
+++ b/changes/ticket25163
@@ -0,0 +1,4 @@
+ o Code simplification and refactoring (rephist):
+ - Remove a series of counters used to track circuit extend attemps and
+ connection status but that in reality we aren't using for anything other
+ than stats logged by a SIGUSR1 signal. Closes ticket 25163.
diff --git a/src/or/channel.c b/src/or/channel.c
index 1afd45190..8db974bb3 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -1884,7 +1884,6 @@ channel_do_open_actions(channel_t *chan)
if (started_here) {
circuit_build_times_network_is_live(get_circuit_build_times_mutable());
- rep_hist_note_connect_succeeded(chan->identity_digest, now);
router_set_status(chan->identity_digest, 1);
} else {
/* only report it to the geoip module if it's not a known router */
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 455bb66cb..272a086a3 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -705,7 +705,6 @@ connection_or_finished_connecting(or_connection_t *or_conn)
void
connection_or_about_to_close(or_connection_t *or_conn)
{
- time_t now = time(NULL);
connection_t *conn = TO_CONN(or_conn);
/* Tell the controlling channel we're closed */
@@ -725,7 +724,6 @@ connection_or_about_to_close(or_connection_t *or_conn)
if (connection_or_nonopen_was_started_here(or_conn)) {
const or_options_t *options = get_options();
connection_or_note_state_when_broken(or_conn);
- rep_hist_note_connect_failed(or_conn->identity_digest, now);
/* Tell the new guard API about the channel failure */
entry_guard_chan_failed(TLS_CHAN_TO_BASE(or_conn->chan));
if (conn->state >= OR_CONN_STATE_TLS_HANDSHAKING) {
@@ -741,11 +739,9 @@ connection_or_about_to_close(or_connection_t *or_conn)
} else if (conn->hold_open_until_flushed) {
/* We only set hold_open_until_flushed when we're intentionally
* closing a connection. */
- rep_hist_note_disconnect(or_conn->identity_digest, now);
control_event_or_conn_status(or_conn, OR_CONN_EVENT_CLOSED,
tls_error_to_orconn_end_reason(or_conn->tls_error));
} else if (!tor_digest_is_zero(or_conn->identity_digest)) {
- rep_hist_note_connection_died(or_conn->identity_digest, now);
control_event_or_conn_status(or_conn, OR_CONN_EVENT_CLOSED,
tls_error_to_orconn_end_reason(or_conn->tls_error));
}
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 7d5394da2..830cd6826 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -116,20 +116,6 @@ typedef struct or_history_t {
time_t since;
/** When did we most recently note a change to this OR? */
time_t changed;
- /** How many times did we successfully connect? */
- unsigned long n_conn_ok;
- /** How many times did we try to connect and fail?*/
- unsigned long n_conn_fail;
- /** How many seconds have we been connected to this OR before
- * 'up_since'? */
- unsigned long uptime;
- /** How many seconds have we been unable to connect to this OR before
- * 'down_since'? */
- unsigned long downtime;
- /** If nonzero, we have been connected since this time. */
- time_t up_since;
- /** If nonzero, we have been unable to connect since this time. */
- time_t down_since;
/** The address at which we most recently connected to this OR
* successfully. */
@@ -233,23 +219,6 @@ free_or_history(void *_hist)
tor_free(hist);
}
-/** Update an or_history_t object <b>hist</b> so that its uptime/downtime
- * count is up-to-date as of <b>when</b>.
- */
-static void
-update_or_history(or_history_t *hist, time_t when)
-{
- tor_assert(hist);
- if (hist->up_since) {
- tor_assert(!hist->down_since);
- hist->uptime += (when - hist->up_since);
- hist->up_since = when;
- } else if (hist->down_since) {
- hist->downtime += (when - hist->down_since);
- hist->down_since = when;
- }
-}
-
/** Initialize the static data structures for tracking history. */
void
rep_hist_init(void)
@@ -259,99 +228,6 @@ rep_hist_init(void)
predicted_ports_alloc();
}
-/** Helper: note that we are no longer connected to the router with history
- * <b>hist</b>. If <b>failed</b>, the connection failed; otherwise, it was
- * closed correctly. */
-static void
-mark_or_down(or_history_t *hist, time_t when, int failed)
-{
- if (hist->up_since) {
- hist->uptime += (when - hist->up_since);
- hist->up_since = 0;
- }
- if (failed && !hist->down_since) {
- hist->down_since = when;
- }
-}
-
-/** Helper: note that we are connected to the router with history
- * <b>hist</b>. */
-static void
-mark_or_up(or_history_t *hist, time_t when)
-{
- if (hist->down_since) {
- hist->downtime += (when - hist->down_since);
- hist->down_since = 0;
- }
- if (!hist->up_since) {
- hist->up_since = when;
- }
-}
-
-/** Remember that an attempt to connect to the OR with identity digest
- * <b>id</b> failed at <b>when</b>.
- */
-void
-rep_hist_note_connect_failed(const char* id, time_t when)
-{
- or_history_t *hist;
- hist = get_or_history(id);
- if (!hist)
- return;
- ++hist->n_conn_fail;
- mark_or_down(hist, when, 1);
- hist->changed = when;
-}
-
-/** Remember that an attempt to connect to the OR with identity digest
- * <b>id</b> succeeded at <b>when</b>.
- */
-void
-rep_hist_note_connect_succeeded(const char* id, time_t when)
-{
- or_history_t *hist;
- hist = get_or_history(id);
- if (!hist)
- return;
- ++hist->n_conn_ok;
- mark_or_up(hist, when);
- hist->changed = when;
-}
-
-/** Remember that we intentionally closed our connection to the OR
- * with identity digest <b>id</b> at <b>when</b>.
- */
-void
-rep_hist_note_disconnect(const char* id, time_t when)
-{
- or_history_t *hist;
- hist = get_or_history(id);
- if (!hist)
- return;
- mark_or_down(hist, when, 0);
- hist->changed = when;
-}
-
-/** Remember that our connection to the OR with identity digest
- * <b>id</b> had an error and stopped working at <b>when</b>.
- */
-void
-rep_hist_note_connection_died(const char* id, time_t when)
-{
- or_history_t *hist;
- if (!id) {
- /* If conn has no identity, it didn't complete its handshake, or something
- * went wrong. Ignore it.
- */
- return;
- }
- hist = get_or_history(id);
- if (!hist)
- return;
- mark_or_down(hist, when, 1);
- hist->changed = when;
-}
-
/** We have just decided that this router with identity digest <b>id</b> is
* reachable, meaning we will give it a "Running" flag for the next while. */
void
@@ -488,7 +364,6 @@ rep_hist_make_router_pessimal(const char *id, time_t when)
tor_assert(hist);
rep_hist_note_router_unreachable(id, when);
- mark_or_down(hist, when, 1);
hist->weighted_run_length = 0;
hist->weighted_uptime = 0;
@@ -676,8 +551,6 @@ rep_hist_dump_stats(time_t now, int severity)
char hexdigest1[HEX_DIGEST_LEN+1];
or_history_t *or_history;
void *or_history_p;
- double uptime;
- unsigned long upt, downt;
const node_t *node;
rep_history_clean(now - get_options()->RephistTrackTime);
@@ -697,22 +570,11 @@ rep_hist_dump_stats(time_t now, int severity)
else
name1 = "(unknown)";
base16_encode(hexdigest1, sizeof(hexdigest1), digest1, DIGEST_LEN);
- update_or_history(or_history, now);
- upt = or_history->uptime;
- downt = or_history->downtime;
s = get_stability(or_history, now);
stability = (long)s;
- if (upt+downt) {
- uptime = ((double)upt) / (upt+downt);
- } else {
- uptime=1.0;
- }
tor_log(severity, LD_HIST,
- "OR %s [%s]: %ld/%ld good connections; uptime %ld/%ld sec (%.2f%%); "
- "wmtbf %lu:%02lu:%02lu",
+ "OR %s [%s]: wmtbf %lu:%02lu:%02lu",
name1, hexdigest1,
- or_history->n_conn_ok, or_history->n_conn_fail+or_history->n_conn_ok,
- upt, upt+downt, uptime*100.0,
stability/3600, (stability/60)%60, stability%60);
}
}
diff --git a/src/or/rephist.h b/src/or/rephist.h
index 1f3ab3a28..507272159 100644
--- a/src/or/rephist.h
+++ b/src/or/rephist.h
@@ -13,10 +13,6 @@
#define TOR_REPHIST_H
void rep_hist_init(void);
-void rep_hist_note_connect_failed(const char* nickname, time_t when);
-void rep_hist_note_connect_succeeded(const char* nickname, time_t when);
-void rep_hist_note_disconnect(const char* nickname, time_t when);
-void rep_hist_note_connection_died(const char* nickname, time_t when);
void rep_hist_dump_stats(time_t now, int severity);
void rep_hist_note_bytes_read(size_t num_bytes, time_t when);
void rep_hist_note_bytes_written(size_t num_bytes, time_t when);
[View Less]
commit a7440d9c9df1141a5ff52c1358bc28a8bb27bea3
Author: Roger Dingledine <arma(a)torproject.org>
Date: Wed Feb 7 12:22:29 2018 -0500
more fixes for typos, grammar, whitespace, etc
some of these ought to have been noticed by the "misspell" tool,
so if anybody is debugging it, here are some bug reports :)
---
ChangeLog | 2 +-
ReleaseNotes | 2 +-
src/common/compat.c | 2 +-
src/common/crypto.c | 2 +-
src/or/channel.c | 19 +++…
[View More]+++++-----------
src/or/channelpadding.c | 2 +-
src/or/channeltls.c | 2 +-
src/or/command.c | 2 +-
src/or/cpuworker.c | 2 +-
src/or/hs_cache.c | 2 +-
src/or/hs_circuit.c | 10 +++++-----
src/or/main.c | 2 +-
src/or/or.h | 2 +-
src/or/rendcache.c | 2 +-
src/or/rendservice.c | 2 +-
src/or/routerlist.c | 4 ++--
src/or/scheduler_kist.c | 2 +-
src/or/status.c | 2 +-
18 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fa1a9e573..b97d2f9eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -444,7 +444,7 @@ Changes in version 0.3.2.9 - 2018-01-09
o Minor bugfixes (portability, msvc):
- Fix a bug in the bit-counting parts of our timing-wheel code on
MSVC. (Note that MSVC is still not a supported build platform, due
- to cyptographic timing channel risks.) Fixes bug 24633; bugfix
+ to cryptographic timing channel risks.) Fixes bug 24633; bugfix
on 0.2.9.1-alpha.
diff --git a/ReleaseNotes b/ReleaseNotes
index 4adba49d7..6c31d8ab0 100644
--- a/ReleaseNotes
+++ b/ReleaseNotes
@@ -621,7 +621,7 @@ Changes in version 0.3.2.9 - 2018-01-09
Hurd. Fixes bug 23098; bugfix on 0.3.1.1-alpha.
- Fix a bug in the bit-counting parts of our timing-wheel code on
MSVC. (Note that MSVC is still not a supported build platform, due
- to cyptographic timing channel risks.) Fixes bug 24633; bugfix
+ to cryptographic timing channel risks.) Fixes bug 24633; bugfix
on 0.2.9.1-alpha.
o Minor bugfixes (relay):
diff --git a/src/common/compat.c b/src/common/compat.c
index 39d2f18f4..4cb346dfa 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2890,7 +2890,7 @@ compute_num_cpus(void)
/** Helper: Deal with confused or out-of-bounds values from localtime_r and
* friends. (On some platforms, they can give out-of-bounds values or can
* return NULL.) If <b>islocal</b>, this is a localtime result; otherwise
- * it's from gmtime. The function returned <b>r</b>, when given <b>timep</b>
+ * it's from gmtime. The function returns <b>r</b>, when given <b>timep</b>
* as its input. If we need to store new results, store them in
* <b>resultbuf</b>. */
static struct tm *
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 6e420ab05..affcda40f 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -1915,7 +1915,7 @@ crypto_strongest_rand_syscall(uint8_t *out, size_t out_len)
return 0;
#elif defined(__linux__) && defined(SYS_getrandom)
- static int getrandom_works = 1; /* Be optimitic about our chances... */
+ static int getrandom_works = 1; /* Be optimistic about our chances... */
/* getrandom() isn't as straightforward as getentropy(), and has
* no glibc wrapper.
diff --git a/src/or/channel.c b/src/or/channel.c
index e5cdf9bc7..76d1167a4 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -1435,7 +1435,6 @@ channel_clear_remote_end(channel_t *chan)
/**
* Write to a channel the given packed cell.
*
- *
* Two possible errors can happen. Either the channel is not opened or the
* lower layer (specialized channel) failed to write it. In both cases, it is
* the caller responsibility to free the cell.
@@ -1864,12 +1863,11 @@ channel_listener_process_incoming(channel_listener_t *listener)
* this comes from the old connection_or_set_state_open() of connection_or.c.
*
* Because of this mechanism, future channel_t subclasses should take care
- * not to change a channel to from CHANNEL_STATE_OPENING to CHANNEL_STATE_OPEN
+ * not to change a channel from CHANNEL_STATE_OPENING to CHANNEL_STATE_OPEN
* until there is positive confirmation that the network is operational.
* In particular, anything UDP-based should not make this transition until a
* packet is received from the other side.
*/
-
void
channel_do_open_actions(channel_t *chan)
{
@@ -3199,7 +3197,7 @@ channel_num_cells_writeable(channel_t *chan)
********************/
/**
- * Update the created timestamp for a channel
+ * Update the created timestamp for a channel.
*
* This updates the channel's created timestamp and should only be called
* from channel_init().
@@ -3216,7 +3214,7 @@ channel_timestamp_created(channel_t *chan)
}
/**
- * Update the created timestamp for a channel listener
+ * Update the created timestamp for a channel listener.
*
* This updates the channel listener's created timestamp and should only be
* called from channel_init_listener().
@@ -3233,7 +3231,7 @@ channel_listener_timestamp_created(channel_listener_t *chan_l)
}
/**
- * Update the last active timestamp for a channel
+ * Update the last active timestamp for a channel.
*
* This function updates the channel's last active timestamp; it should be
* called by the lower layer whenever there is activity on the channel which
@@ -3258,9 +3256,8 @@ channel_timestamp_active(channel_t *chan)
}
/**
- * Update the last active timestamp for a channel listener
+ * Update the last active timestamp for a channel listener.
*/
-
void
channel_listener_timestamp_active(channel_listener_t *chan_l)
{
@@ -3278,7 +3275,6 @@ channel_listener_timestamp_active(channel_listener_t *chan_l)
* should be called whenever a new incoming channel is accepted on a
* listener.
*/
-
void
channel_listener_timestamp_accepted(channel_listener_t *chan_l)
{
@@ -3308,7 +3304,7 @@ channel_timestamp_client(channel_t *chan)
}
/**
- * Update the recv timestamp
+ * Update the recv timestamp.
*
* This is called whenever we get an incoming cell from the lower layer.
* This also updates the active timestamp.
@@ -3329,7 +3325,8 @@ channel_timestamp_recv(channel_t *chan)
}
/**
- * Update the xmit timestamp
+ * Update the xmit timestamp.
+ *
* This is called whenever we pass an outgoing cell to the lower layer. This
* also updates the active timestamp.
*/
diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c
index 70a906d23..5da3009e6 100644
--- a/src/or/channelpadding.c
+++ b/src/or/channelpadding.c
@@ -69,7 +69,7 @@ static int consensus_nf_pad_single_onion;
/**
* This macro tells us if either end of the channel is connected to a client.
* (If we're not a server, we're definitely a client. If the channel thinks
- * its a client, use that. Then finally verify in the consensus).
+ * it's a client, use that. Then finally verify in the consensus).
*/
#define CHANNEL_IS_CLIENT(chan, options) \
(!public_server_mode((options)) || channel_is_client(chan) || \
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index ba3517852..2302c194b 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -1588,7 +1588,7 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
}
}
- /* We set this after sending the verions cell. */
+ /* We set this after sending the versions cell. */
/*XXXXX symbolic const.*/
TLS_CHAN_TO_BASE(chan)->wide_circ_ids =
chan->conn->link_proto >= MIN_LINK_PROTO_FOR_WIDE_CIRC_IDS;
diff --git a/src/or/command.c b/src/or/command.c
index 185596a65..7280be139 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -286,7 +286,7 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
"Received create cell but we're shutting down. Sending back "
"destroy.");
channel_send_destroy(cell->circ_id, chan,
- END_CIRC_REASON_HIBERNATING);
+ END_CIRC_REASON_HIBERNATING);
return;
}
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 9bec04d79..50761dd4d 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -250,7 +250,7 @@ should_time_request(uint16_t onionskin_type)
}
/** Return an estimate of how many microseconds we will need for a single
- * cpuworker to to process <b>n_requests</b> onionskins of type
+ * cpuworker to process <b>n_requests</b> onionskins of type
* <b>onionskin_type</b>. */
uint64_t
estimated_usec_for_onionskins(uint32_t n_requests, uint16_t onionskin_type)
diff --git a/src/or/hs_cache.c b/src/or/hs_cache.c
index b852feb02..df53efd32 100644
--- a/src/or/hs_cache.c
+++ b/src/or/hs_cache.c
@@ -702,7 +702,7 @@ cache_clean_v3_as_client(time_t now)
/* Entry is not in the cache anymore, destroy it. */
cache_client_desc_free(entry);
/* Update our OOM. We didn't use the remove() function because we are in
- * a loop so we have to explicitey decrement. */
+ * a loop so we have to explicitly decrement. */
rend_cache_decrement_allocation(entry_size);
/* Logging. */
{
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 2a41c1ccc..faa4b5d45 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -699,12 +699,12 @@ hs_circ_service_get_intro_circ(const hs_service_intro_point_t *ip)
*
* We currently relaunch connections to rendezvous points if:
* - A rendezvous circuit timed out before connecting to RP.
- * - The redenzvous circuit failed to connect to the RP.
+ * - The rendezvous circuit failed to connect to the RP.
*
* We avoid relaunching a connection to this rendezvous point if:
- * - We have already tried MAX_REND_FAILURES times to connect to this RP.
+ * - We have already tried MAX_REND_FAILURES times to connect to this RP,
* - We've been trying to connect to this RP for more than MAX_REND_TIMEOUT
- * seconds
+ * seconds, or
* - We've already retried this specific rendezvous circuit.
*/
void
@@ -718,11 +718,11 @@ hs_circ_retry_service_rendezvous_point(origin_circuit_t *circ)
goto done;
}
- /* Flag the circuit that we are relaunching so to avoid to relaunch twice a
+ /* Flag the circuit that we are relaunching, to avoid to relaunch twice a
* circuit to the same rendezvous point at the same time. */
circ->hs_service_side_rend_circ_has_been_relaunched = 1;
- /* Legacy service don't have an hidden service ident. */
+ /* Legacy service don't have a hidden service ident. */
if (circ->hs_ident) {
retry_service_rendezvous_point(circ);
} else {
diff --git a/src/or/main.c b/src/or/main.c
index 800efd68c..9ffc962d3 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -3376,7 +3376,7 @@ tor_init(int argc, char *argv[])
log_warn(LD_NET, "Problem initializing libevent RNG.");
}
- /* Scan/clean unparseable descroptors; after reading config */
+ /* Scan/clean unparseable descriptors; after reading config */
routerparse_init();
return 0;
diff --git a/src/or/or.h b/src/or/or.h
index 51f7d4333..03efdd1d8 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -5380,7 +5380,7 @@ typedef struct rend_intro_point_t {
*/
int accepted_introduce2_count;
- /** (Service side only) Number of maximum INTRODUCE2 cells that this IP
+ /** (Service side only) Maximum number of INTRODUCE2 cells that this IP
* will accept. This is a random value between
* INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS and
* INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS. */
diff --git a/src/or/rendcache.c b/src/or/rendcache.c
index 30115d0bb..d27e1c293 100644
--- a/src/or/rendcache.c
+++ b/src/or/rendcache.c
@@ -48,7 +48,7 @@ STATIC digestmap_t *rend_cache_v2_dir = NULL;
* Once a descriptor is removed from the rend cache or expires, the entry
* in this cache is also removed for the service ID.
*
- * This scheme allows us to not relay on the descriptor's timestamp (which
+ * This scheme allows us to not rely on the descriptor's timestamp (which
* is rounded down to the hour) to know if we have a newer descriptor. We
* only rely on the usability of intro points from an internal state. */
STATIC strmap_t *rend_cache_failure = NULL;
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index b07a7a7a7..cc2242977 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -4286,7 +4286,7 @@ rend_service_dump_stats(int severity)
}
/** Given <b>conn</b>, a rendezvous exit stream, look up the hidden service for
- * 'circ', and look up the port and address based on conn-\>port.
+ * <b>circ</b>, and look up the port and address based on conn-\>port.
* Assign the actual conn-\>addr and conn-\>port. Return -2 on failure
* for which the circuit should be closed, -1 on other failure,
* or 0 for success.
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 1bd6d5db5..696bb454f 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -235,7 +235,7 @@ get_n_authorities(dirinfo_type_t type)
return n;
}
-/** Initialise schedule, want_authority, and increment on in the download
+/** Initialise schedule, want_authority, and increment_on in the download
* status dlstatus, then call download_status_reset() on it.
* It is safe to call this function or download_status_reset() multiple times
* on a new dlstatus. But it should *not* be called after a dlstatus has been
@@ -1170,7 +1170,7 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now,
} SMARTLIST_FOREACH_END(voter);
}
- /* Bridge clients look up the node for the dir_hint */
+ /* Bridge clients look up the node for the dir_hint */
const node_t *node = NULL;
/* All clients, including bridge clients, look up the routerstatus for the
* dir_hint */
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c
index 43831b72b..6d6490077 100644
--- a/src/or/scheduler_kist.c
+++ b/src/or/scheduler_kist.c
@@ -373,7 +373,7 @@ set_scheduler_run_interval(void)
}
}
-/* Return true iff the channel hasn’t hit its kist-imposed write limit yet */
+/* Return true iff the channel hasn't hit its kist-imposed write limit yet */
static int
socket_can_write(socket_table_t *table, const channel_t *chan)
{
diff --git a/src/or/status.c b/src/or/status.c
index ec025a1cc..4f7be164b 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -42,7 +42,7 @@ count_circuits(void)
}
/** Take seconds <b>secs</b> and return a newly allocated human-readable
- * uptime string */
+ * uptime string. */
STATIC char *
secs_to_uptime(long secs)
{
[View Less]
commit fe3dfe7e38b4ad0c11ff05b7dbd0a9b1d7efc4a8
Author: David Goulet <dgoulet(a)torproject.org>
Date: Wed Feb 7 10:23:24 2018 -0500
test: Bump to 10 msec gap in the monotonic test
On slow system, 1 msec between one read and the other was too tight. For
instance, it failed on armel with a 4msec gap:
https://buildd.debian.org/status/package.php?p=tor&suite=experimental
Increase to 10 msec for now to address slow system. It is important that we
…
[View More] keep this OP_LE test in so we make sure the msec/usec/nsec read aren't
desynchronized by huge gaps. We'll adjust again if we ever encounter a system
that goes slower than 10 msec between calls.
Fixes #25113
Signed-off-by: David Goulet <dgoulet(a)torproject.org>
---
changes/bug25113 | 5 +++++
src/test/test_util.c | 8 ++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/changes/bug25113 b/changes/bug25113
new file mode 100644
index 000000000..4a020b784
--- /dev/null
+++ b/changes/bug25113
@@ -0,0 +1,5 @@
+ o Minor bugfixes (unit test, monotonic time):
+ - Bump a gap of 1msec to 10msec used in the monotonic time test that makes
+ sure the nsec/usec/msec time read are synchronized. This change was
+ needed to accommodate slow system like armel or when the clock_gettime()
+ is not a VDSO on the running kernel. Fixes bug 25113; bugfix on 0.2.9.1.
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 0b707caee..dd122b250 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -5541,10 +5541,10 @@ test_util_monotonic_time(void *arg)
tt_u64_op(usec1, OP_GE, nsec1 / 1000);
tt_u64_op(msecc1, OP_GE, nsecc1 / 1000000);
tt_u64_op(usecc1, OP_GE, nsecc1 / 1000);
- tt_u64_op(msec1, OP_LE, nsec1 / 1000000 + 1);
- tt_u64_op(usec1, OP_LE, nsec1 / 1000 + 1000);
- tt_u64_op(msecc1, OP_LE, nsecc1 / 1000000 + 1);
- tt_u64_op(usecc1, OP_LE, nsecc1 / 1000 + 1000);
+ tt_u64_op(msec1, OP_LE, nsec1 / 1000000 + 10);
+ tt_u64_op(usec1, OP_LE, nsec1 / 1000 + 10000);
+ tt_u64_op(msecc1, OP_LE, nsecc1 / 1000000 + 10);
+ tt_u64_op(usecc1, OP_LE, nsecc1 / 1000 + 10000);
done:
;
[View Less]