minor cleanups

svn:r8622
This commit is contained in:
Roger Dingledine 2006-10-07 00:50:39 +00:00
parent 8ba5471de3
commit 06e5b2283c
10 changed files with 39 additions and 38 deletions

View File

@ -65,9 +65,9 @@ Changes in version 0.1.2.2-alpha - 2006-10-??
a hostname; any router can call itself Unnamed; directory a hostname; any router can call itself Unnamed; directory
authorities will never allocate Unnamed to any particular router; authorities will never allocate Unnamed to any particular router;
clients won't believe that any router is the canonical Unnamed. clients won't believe that any router is the canonical Unnamed.
- Only include function names in log messages for debugging messages; - Only include function names in log messages for info/debug messages.
in other cases, the content of the message should be clear on its For notice/warn/err, the content of the message should be clear on
own, and including the function name only seems to confuse users. its own, and printing the function name only seems to confuse users.
- Avoid some false positives during reachability testing: don't try - Avoid some false positives during reachability testing: don't try
to test via a server that's on the same /24 as us. to test via a server that's on the same /24 as us.
- New controller event to alert the controller when our server - 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 - Be clearer that the *ListenAddress directives can be repeated
multiple times. multiple times.
(stopped at r8519) (stopped at r8536)
- Build correctly for use on OS X platforms with case-sensitive - Build correctly for use on OS X platforms with case-sensitive
filesystems. filesystems.

View File

@ -727,7 +727,7 @@ TODO:
with a REASON_NOTDIRECTORY RELAY_END cell. with a REASON_NOTDIRECTORY RELAY_END cell.
[RELAY_BEGIN_DIR was not supported before Tor 0.1.2.2-alpha; clients [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 6.3. Closing streams

View File

@ -542,7 +542,7 @@ smartlist_heapify(smartlist_t *sl,
} }
/** Insert <b>item</b> into the heap stored in <b>sl</b>, where order /** Insert <b>item</b> into the heap stored in <b>sl</b>, where order
* is determined by <b>compare</b> */ * is determined by <b>compare</b>. */
void void
smartlist_pqueue_add(smartlist_t *sl, smartlist_pqueue_add(smartlist_t *sl,
int (*compare)(const void *a, const void *b), 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); 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 static INLINE unsigned int
strmap_entry_hash(strmap_entry_t *a) 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); 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 static INLINE unsigned int
digestmap_entry_hash(digestmap_entry_t *a) digestmap_entry_hash(digestmap_entry_t *a)
{ {
@ -1051,7 +1051,7 @@ digestmap_isempty(digestmap_t *map)
return HT_EMPTY(&map->head); return HT_EMPTY(&map->head);
} }
/** Return the number of items in <b>map</b> */ /** Return the number of items in <b>map</b>. */
int int
strmap_size(strmap_t *map) strmap_size(strmap_t *map)
{ {

View File

@ -1816,7 +1816,7 @@ entry_guard_set_status(entry_guard_t *e, routerinfo_t *ri,
return changed; 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 <b>e</b> that we're willing to try again. */ * unreachable guard <b>e</b> that we're willing to try again. */
static int static int
entry_is_time_to_retry(entry_guard_t *e, time_t now) 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 /** Dump a description of our list of entry guards to the log at level
* <b>severity</b> */ * <b>severity</b>. */
static void static void
log_entry_guards(int severity) log_entry_guards(int severity)
{ {

View File

@ -2144,7 +2144,7 @@ connection_exit_connect(edge_connection_t *edge_conn)
* bridge connection with a socketpair, create a new directory conn, and join * 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 * 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. * 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 static int
connection_exit_connect_dir(edge_connection_t *exit_conn) 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) { if (connection_add(TO_CONN(exit_conn))<0) {
connection_edge_end(exit_conn, END_STREAM_REASON_RESOURCELIMIT, connection_edge_end(exit_conn, END_STREAM_REASON_RESOURCELIMIT,
exit_conn->cpath_layer); exit_conn->cpath_layer);
/* XXXX Have I got the free/mark distinction right? -NM */
connection_free(TO_CONN(exit_conn)); connection_free(TO_CONN(exit_conn));
connection_free(TO_CONN(dir_conn)); connection_free(TO_CONN(dir_conn));
return 0; return 0;

View File

@ -66,23 +66,23 @@ const char control_c_id[] =
* because it use used both as a list of v0 event types, and as indices * 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. * into the bitfield to determine which controllers want which events.
*/ */
#define _EVENT_MIN 0x0001 #define _EVENT_MIN 0x0001
#define EVENT_CIRCUIT_STATUS 0x0001 #define EVENT_CIRCUIT_STATUS 0x0001
#define EVENT_STREAM_STATUS 0x0002 #define EVENT_STREAM_STATUS 0x0002
#define EVENT_OR_CONN_STATUS 0x0003 #define EVENT_OR_CONN_STATUS 0x0003
#define EVENT_BANDWIDTH_USED 0x0004 #define EVENT_BANDWIDTH_USED 0x0004
#define EVENT_LOG_OBSOLETE 0x0005 #define EVENT_LOG_OBSOLETE 0x0005
#define EVENT_NEW_DESC 0x0006 #define EVENT_NEW_DESC 0x0006
#define EVENT_DEBUG_MSG 0x0007 #define EVENT_DEBUG_MSG 0x0007
#define EVENT_INFO_MSG 0x0008 #define EVENT_INFO_MSG 0x0008
#define EVENT_NOTICE_MSG 0x0009 #define EVENT_NOTICE_MSG 0x0009
#define EVENT_WARN_MSG 0x000A #define EVENT_WARN_MSG 0x000A
#define EVENT_ERR_MSG 0x000B #define EVENT_ERR_MSG 0x000B
#define LAST_V0_EVENT 0x000B #define LAST_V0_EVENT 0x000B
#define EVENT_ADDRMAP 0x000C #define EVENT_ADDRMAP 0x000C
#define EVENT_AUTHDIR_NEWDESCS 0x000D #define EVENT_AUTHDIR_NEWDESCS 0x000D
#define EVENT_DESCCHANGED 0x000E #define EVENT_DESCCHANGED 0x000E
#define _EVENT_MAX 0x000E #define _EVENT_MAX 0x000E
/** Array mapping from message type codes to human-readable message /** Array mapping from message type codes to human-readable message
* type names. Used for compatibility with version 0 of the control * type names. Used for compatibility with version 0 of the control

View File

@ -129,6 +129,8 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
int directconn = !purpose_is_private(purpose); int directconn = !purpose_is_private(purpose);
authority_type_t type; authority_type_t type;
/* FFFF we could break this switch into its own function, and call
* it elsewhere in directory.c. -RD */
switch (purpose) { switch (purpose) {
case DIR_PURPOSE_FETCH_NETWORKSTATUS: case DIR_PURPOSE_FETCH_NETWORKSTATUS:
case DIR_PURPOSE_FETCH_SERVERDESC: case DIR_PURPOSE_FETCH_SERVERDESC:
@ -182,7 +184,7 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
if (!directconn) { if (!directconn) {
/* Never use fascistfirewall; we're going via Tor. */ /* Never use fascistfirewall; we're going via Tor. */
if (purpose == DIR_PURPOSE_FETCH_RENDDESC) { 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, rs = router_pick_trusteddirserver(HIDSERV_AUTHORITY, 0, 0,
retry_if_no_servers); retry_if_no_servers);
} else { } else {
@ -191,7 +193,7 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
retry_if_no_servers); retry_if_no_servers);
/* If we have any hope of building an indirect conn, we know some router /* 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 * 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. */
} }
} }

View File

@ -2535,7 +2535,7 @@ typedef struct trusted_dir_server_t {
/** True iff this server is an authority for the newer ("v2") directory /** True iff this server is an authority for the newer ("v2") directory
* protocol. */ * protocol. */
unsigned int is_v2_authority:1; 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; unsigned int is_hidserv_authority:1;
int n_networkstatus_failures; /**< How many times have we asked for this int n_networkstatus_failures; /**< How many times have we asked for this

View File

@ -361,10 +361,10 @@ init_keys(void)
crypto_pk_get_digest(get_identity_key(), digest); crypto_pk_get_digest(get_identity_key(), digest);
if (!router_digest_is_trusted_dir(digest)) { if (!router_digest_is_trusted_dir(digest)) {
add_trusted_dir_server(options->Nickname, NULL, add_trusted_dir_server(options->Nickname, NULL,
(uint16_t)options->DirPort, digest, (uint16_t)options->DirPort, digest,
options->V1AuthoritativeDir, /* v1 authority */ options->V1AuthoritativeDir, /* v1 authority */
1, /* v2 authority */ 1, /* v2 authority */
options->HSAuthoritativeDir /* hidserv authority */); options->HSAuthoritativeDir /*hidserv authority*/);
} }
return 0; /* success */ return 0; /* success */
} }

View File

@ -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); base16_encode(fp, HEX_DIGEST_LEN+1, ns->identity_digest, DIGEST_LEN);
if (!(trusted_dir = if (!(trusted_dir =
router_get_trusteddirserver_by_digest(ns->identity_digest)) router_get_trusteddirserver_by_digest(ns->identity_digest)) ||
|| !trusted_dir->is_v2_authority) { !trusted_dir->is_v2_authority) {
log_info(LD_DIR, "Network status was signed, but not by an authoritative " log_info(LD_DIR, "Network status was signed, but not by an authoritative "
"directory we recognize."); "directory we recognize.");
if (!get_options()->DirPort) { if (!get_options()->DirPort) {