Commit df5e8f65 authored by Nick Mathewson's avatar Nick Mathewson 🤹
Browse files

Add more missing documentation, and correct an error in container.c...

Add more missing documentation, and correct an error in container.c documentation: Don't introduce two parameters called n when you're calling an algorithm O(n).

svn:r17783
parent 41aef359
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1199,7 +1199,7 @@ digestmap_size(const digestmap_t *map)
 * function for an array of type <b>elt_t</b>*.
 *
 * NOTE: The implementation kind of sucks: It's O(n log n), whereas finding
 * the nth element of a list can be done in O(n).  Then again, this
 * the kth element of an n-element list can be done in O(n).  Then again, this
 * implementation is not in critical path, and it is obviously correct. */
#define IMPLEMENT_ORDER_FUNC(funcname, elt_t)                   \
  static int                                                    \
+4 −2
Original line number Diff line number Diff line
@@ -34,9 +34,11 @@ static int connection_process_inbuf(connection_t *conn, int package_partial);
static void client_check_address_changed(int sock);
static void set_constrained_socket_buffers(int sock, int size);

/* DOCDOC last_interface_ip */
/** The last IPv4 address that our network interface seemed to have been
 * binding to, in host order.  We use this to detect when our IP changes. */
static uint32_t last_interface_ip = 0;
/* DOCDOC outgoing_addrs */
/** A list of uint32_ts for addresses we've used in outgoing connections.
 * Used to detect IP address changes. */
static smartlist_t *outgoing_addrs = NULL;

/**************************************************************/
+15 −10
Original line number Diff line number Diff line
@@ -1646,25 +1646,30 @@ should_generate_v2_networkstatus(void)
 * dirserv_compute_performance_thresholds, and used by
 * generate_v2_networkstatus */

/* DOCDOC stable_uptime */
/** Any router with an uptime of at least this value is stable. */
static uint32_t stable_uptime = 0; /* start at a safe value */
/* DOCDOC stable_mtbf */
/** Any router with an mtbf of at least this value is stable. */
static double stable_mtbf = 0.0;
/* DOCDOC enough_mtbf_info */
/** If true, we have measured enough mtbf info to look at stable_mtbf rather
 * than stable_uptime. */
static int enough_mtbf_info = 0;
/* DOCDOC guard_wfu */
/** Any router with a weighted fractional uptime of at least this much might
 * be good as a guard. */
static double guard_wfu = 0.0;
/* DOCDOC guard_tk */
/** Don't call a router a guard unless we've known about it for at least this
 * many seconds. */
static long guard_tk = 0;
/* DOCDOC fast_bandwidth */
/** Any router with a bandwidth at least this high is "Fast" */
static uint32_t fast_bandwidth = 0;
/* DOCDOC guard_bandwidth_including_exits */
/** If exits can be guards, then all guards must have a bandwidth this
 * high. */
static uint32_t guard_bandwidth_including_exits = 0;
/* DOCDOC guard_bandwidth_excluding_exits */
/** If exits can't be guards, then all guards must have a bandwidth this
 * high. */
static uint32_t guard_bandwidth_excluding_exits = 0;
/* DOCDOC total_bandwidth */
/** Total bandwidth of all the routers we're considering. */
static uint64_t total_bandwidth = 0;
/* DOCDOC total_exit_bandwidth */
/** Total bandwidth of all the exit routers we're considering. */
static uint64_t total_exit_bandwidth = 0;

/** Helper: estimate the uptime of a router given its stated uptime and the
+5 −5
Original line number Diff line number Diff line
@@ -710,12 +710,12 @@ router_set_networkstatus_v2(const char *s, time_t arrived_at,
  if (!found)
    smartlist_add(networkstatus_v2_list, ns);

/*XXXX021 magic. */
/*DOCDOC */
#define V2_NETWORKSTATUS_LIFETIME (3*60*60)
/** Retain any routerinfo mentioned in a V2 networkstatus for at least this
 * long. */
#define V2_NETWORKSTATUS_ROUTER_LIFETIME (3*60*60)

  {
    time_t live_until = ns->published_on + V2_NETWORKSTATUS_LIFETIME;
    time_t live_until = ns->published_on + V2_NETWORKSTATUS_ROUTER_LIFETIME;
    SMARTLIST_FOREACH(ns->entries, routerstatus_t *, rs,
    {
      signed_descriptor_t *sd =
@@ -1755,7 +1755,7 @@ routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
  /* Now update last_listed_as_valid_until from v2 networkstatuses. */
  /* XXXX If this is slow, we need to rethink the code. */
  SMARTLIST_FOREACH(networkstatus_v2_list, networkstatus_v2_t *, ns, {
    time_t live_until = ns->published_on + V2_NETWORKSTATUS_LIFETIME;
    time_t live_until = ns->published_on + V2_NETWORKSTATUS_ROUTER_LIFETIME;
    SMARTLIST_FOREACH_JOIN(ns->entries, routerstatus_t *, rs,
                         routers, routerinfo_t *, ri,
                         memcmp(rs->identity_digest,
+3 −3
Original line number Diff line number Diff line
@@ -1263,9 +1263,9 @@ bw_array_new(void)
  return b;
}

/* DOCDOC read_array */
/** Recent history of bandwidth observations for read operations. */
static bw_array_t *read_array = NULL;
/* DOCDOC write_array */
/** Recent history of bandwidth observations for write operations. */
static bw_array_t *write_array = NULL;

/** Set up read_array and write_array. */
@@ -1913,7 +1913,7 @@ typedef struct hs_usage_current_observation_period_t {
  time_t start_of_next_period;
} hs_usage_current_observation_period_t;

/* DOCDOC current_period */
/** Usage statistics for the current observation period. */
static hs_usage_current_observation_period_t *current_period = NULL;
/* DOCDOC publish_total */
static hs_usage_service_related_observation_t *publish_total = NULL;
Loading