From 06e5b2283c6b3b256f098191e7b86a44f00b2ccb Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sat, 7 Oct 2006 00:50:39 +0000 Subject: [PATCH] minor cleanups svn:r8622 --- ChangeLog | 8 ++++---- doc/tor-spec.txt | 2 +- src/common/container.c | 8 ++++---- src/or/circuitbuild.c | 4 ++-- src/or/connection_edge.c | 3 +-- src/or/control.c | 32 ++++++++++++++++---------------- src/or/directory.c | 6 ++++-- src/or/or.h | 2 +- src/or/router.c | 8 ++++---- src/or/routerlist.c | 4 ++-- 10 files changed, 39 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6542975746..cdf036ee23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -65,9 +65,9 @@ Changes in version 0.1.2.2-alpha - 2006-10-?? a hostname; any router can call itself Unnamed; directory authorities will never allocate Unnamed to any particular router; clients won't believe that any router is the canonical Unnamed. - - Only include function names in log messages for debugging messages; - in other cases, the content of the message should be clear on its - own, and including the function name only seems to confuse users. + - Only include function names in log messages for info/debug messages. + For notice/warn/err, the content of the message should be clear on + its own, and printing the function name only seems to confuse users. - Avoid some false positives during reachability testing: don't try to test via a server that's on the same /24 as us. - New controller event to alert the controller when our server @@ -176,7 +176,7 @@ Changes in version 0.1.2.2-alpha - 2006-10-?? - Be clearer that the *ListenAddress directives can be repeated multiple times. - (stopped at r8519) + (stopped at r8536) - Build correctly for use on OS X platforms with case-sensitive filesystems. diff --git a/doc/tor-spec.txt b/doc/tor-spec.txt index 7ee285b519..a5f6af666f 100644 --- a/doc/tor-spec.txt +++ b/doc/tor-spec.txt @@ -727,7 +727,7 @@ TODO: with a REASON_NOTDIRECTORY RELAY_END cell. [RELAY_BEGIN_DIR was not supported before Tor 0.1.2.2-alpha; clients - SHOULD NOT send it to routers running earlier version of Tor.] + SHOULD NOT send it to routers running earlier versions of Tor.] 6.3. Closing streams diff --git a/src/common/container.c b/src/common/container.c index 170fe59e28..5facd72d65 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -542,7 +542,7 @@ smartlist_heapify(smartlist_t *sl, } /** Insert item into the heap stored in sl, where order - * is determined by compare */ + * is determined by compare. */ void smartlist_pqueue_add(smartlist_t *sl, int (*compare)(const void *a, const void *b), @@ -636,7 +636,7 @@ strmap_entries_eq(strmap_entry_t *a, strmap_entry_t *b) return !strcmp(a->key, b->key); } -/** Helper: return a hash value for a strmap_entry_t */ +/** Helper: return a hash value for a strmap_entry_t. */ static INLINE unsigned int strmap_entry_hash(strmap_entry_t *a) { @@ -650,7 +650,7 @@ digestmap_entries_eq(digestmap_entry_t *a, digestmap_entry_t *b) return !memcmp(a->key, b->key, DIGEST_LEN); } -/** Helper: return a hash value for a digest_map_t */ +/** Helper: return a hash value for a digest_map_t. */ static INLINE unsigned int digestmap_entry_hash(digestmap_entry_t *a) { @@ -1051,7 +1051,7 @@ digestmap_isempty(digestmap_t *map) return HT_EMPTY(&map->head); } -/** Return the number of items in map */ +/** Return the number of items in map. */ int strmap_size(strmap_t *map) { diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index ee9b0ea516..9b2fd5bc41 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1816,7 +1816,7 @@ entry_guard_set_status(entry_guard_t *e, routerinfo_t *ri, return changed; } -/** Return true iff enought time has passed since we last tried connect to the +/** Return true iff enough time has passed since we last tried connect to the * unreachable guard e that we're willing to try again. */ static int entry_is_time_to_retry(entry_guard_t *e, time_t now) @@ -1896,7 +1896,7 @@ is_an_entry_guard(char *digest) } /** Dump a description of our list of entry guards to the log at level - * severity */ + * severity. */ static void log_entry_guards(int severity) { diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 219b22531a..f942858a77 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2144,7 +2144,7 @@ connection_exit_connect(edge_connection_t *edge_conn) * bridge connection with a socketpair, create a new directory conn, and join * them together. Return 0 on success (or if there was an error we could send * back an end cell for). Return -1 if the circuit needs to be torn down. - * Either connects exit_conn, or frees it, or marks it as appropriate. + * Either connects exit_conn, or frees it, or marks it, as appropriate. */ static int connection_exit_connect_dir(edge_connection_t *exit_conn) @@ -2187,7 +2187,6 @@ connection_exit_connect_dir(edge_connection_t *exit_conn) if (connection_add(TO_CONN(exit_conn))<0) { connection_edge_end(exit_conn, END_STREAM_REASON_RESOURCELIMIT, exit_conn->cpath_layer); - /* XXXX Have I got the free/mark distinction right? -NM */ connection_free(TO_CONN(exit_conn)); connection_free(TO_CONN(dir_conn)); return 0; diff --git a/src/or/control.c b/src/or/control.c index f5ab9570a7..2888746739 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -66,23 +66,23 @@ const char control_c_id[] = * because it use used both as a list of v0 event types, and as indices * into the bitfield to determine which controllers want which events. */ -#define _EVENT_MIN 0x0001 -#define EVENT_CIRCUIT_STATUS 0x0001 -#define EVENT_STREAM_STATUS 0x0002 -#define EVENT_OR_CONN_STATUS 0x0003 -#define EVENT_BANDWIDTH_USED 0x0004 -#define EVENT_LOG_OBSOLETE 0x0005 -#define EVENT_NEW_DESC 0x0006 -#define EVENT_DEBUG_MSG 0x0007 -#define EVENT_INFO_MSG 0x0008 -#define EVENT_NOTICE_MSG 0x0009 -#define EVENT_WARN_MSG 0x000A -#define EVENT_ERR_MSG 0x000B -#define LAST_V0_EVENT 0x000B -#define EVENT_ADDRMAP 0x000C +#define _EVENT_MIN 0x0001 +#define EVENT_CIRCUIT_STATUS 0x0001 +#define EVENT_STREAM_STATUS 0x0002 +#define EVENT_OR_CONN_STATUS 0x0003 +#define EVENT_BANDWIDTH_USED 0x0004 +#define EVENT_LOG_OBSOLETE 0x0005 +#define EVENT_NEW_DESC 0x0006 +#define EVENT_DEBUG_MSG 0x0007 +#define EVENT_INFO_MSG 0x0008 +#define EVENT_NOTICE_MSG 0x0009 +#define EVENT_WARN_MSG 0x000A +#define EVENT_ERR_MSG 0x000B +#define LAST_V0_EVENT 0x000B +#define EVENT_ADDRMAP 0x000C #define EVENT_AUTHDIR_NEWDESCS 0x000D -#define EVENT_DESCCHANGED 0x000E -#define _EVENT_MAX 0x000E +#define EVENT_DESCCHANGED 0x000E +#define _EVENT_MAX 0x000E /** Array mapping from message type codes to human-readable message * type names. Used for compatibility with version 0 of the control diff --git a/src/or/directory.c b/src/or/directory.c index 0c69b0b234..7d1766d6f5 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -129,6 +129,8 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource, int directconn = !purpose_is_private(purpose); authority_type_t type; + /* FFFF we could break this switch into its own function, and call + * it elsewhere in directory.c. -RD */ switch (purpose) { case DIR_PURPOSE_FETCH_NETWORKSTATUS: case DIR_PURPOSE_FETCH_SERVERDESC: @@ -182,7 +184,7 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource, if (!directconn) { /* Never use fascistfirewall; we're going via Tor. */ if (purpose == DIR_PURPOSE_FETCH_RENDDESC) { - /* only ask authdirservers, any of them will do */ + /* only ask hidserv authorities, any of them will do */ rs = router_pick_trusteddirserver(HIDSERV_AUTHORITY, 0, 0, retry_if_no_servers); } else { @@ -191,7 +193,7 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource, retry_if_no_servers); /* If we have any hope of building an indirect conn, we know some router * descriptors. If (rs==NULL), we can't build circuits anyway, so - * there's no point in falling back to the authorities in this case. */ + * there's no point in falling back to the authorities in this case. */ } } diff --git a/src/or/or.h b/src/or/or.h index 7a28b47961..78e2de8276 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2535,7 +2535,7 @@ typedef struct trusted_dir_server_t { /** True iff this server is an authority for the newer ("v2") directory * protocol. */ unsigned int is_v2_authority:1; - /** True iff this server is an authority for hidden services */ + /** True iff this server is an authority for hidden services. */ unsigned int is_hidserv_authority:1; int n_networkstatus_failures; /**< How many times have we asked for this diff --git a/src/or/router.c b/src/or/router.c index e785096915..a5d8895e7b 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -361,10 +361,10 @@ init_keys(void) crypto_pk_get_digest(get_identity_key(), digest); if (!router_digest_is_trusted_dir(digest)) { add_trusted_dir_server(options->Nickname, NULL, - (uint16_t)options->DirPort, digest, - options->V1AuthoritativeDir, /* v1 authority */ - 1, /* v2 authority */ - options->HSAuthoritativeDir /* hidserv authority */); + (uint16_t)options->DirPort, digest, + options->V1AuthoritativeDir, /* v1 authority */ + 1, /* v2 authority */ + options->HSAuthoritativeDir /*hidserv authority*/); } return 0; /* success */ } diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 022341ee95..ed63fd0e40 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2294,8 +2294,8 @@ router_set_networkstatus(const char *s, time_t arrived_at, } base16_encode(fp, HEX_DIGEST_LEN+1, ns->identity_digest, DIGEST_LEN); if (!(trusted_dir = - router_get_trusteddirserver_by_digest(ns->identity_digest)) - || !trusted_dir->is_v2_authority) { + router_get_trusteddirserver_by_digest(ns->identity_digest)) || + !trusted_dir->is_v2_authority) { log_info(LD_DIR, "Network status was signed, but not by an authoritative " "directory we recognize."); if (!get_options()->DirPort) {