aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/container.h2
-rw-r--r--src/common/log.c4
-rw-r--r--src/common/util.c2
-rw-r--r--src/or/buffers.c4
-rw-r--r--src/or/circuitbuild.c22
-rw-r--r--src/or/circuitlist.c10
-rw-r--r--src/or/circuituse.c65
-rw-r--r--src/or/connection.c48
-rw-r--r--src/or/connection_edge.c10
-rw-r--r--src/or/connection_or.c8
-rw-r--r--src/or/cpuworker.c2
-rw-r--r--src/or/directory.c22
-rw-r--r--src/or/dirserv.c2
-rw-r--r--src/or/dns.c8
-rw-r--r--src/or/main.c61
-rw-r--r--src/or/relay.c22
-rw-r--r--src/or/rendclient.c4
-rw-r--r--src/or/router.c60
-rw-r--r--src/or/routerlist.c10
-rw-r--r--src/or/routerparse.c7
20 files changed, 188 insertions, 185 deletions
diff --git a/src/common/container.h b/src/common/container.h
index dbe45a31e..aab568d4a 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -61,7 +61,7 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join,
int var ## _sl_idx, var ## _sl_len=smartlist_len(sl); \
type var; \
for (var ## _sl_idx = 0; var ## _sl_idx < var ## _sl_len; \
- ++var ## _sl_idx) { \
+ ++var ## _sl_idx) { \
var = smartlist_get((sl),var ## _sl_idx); \
cmd; \
} } while (0)
diff --git a/src/common/log.c b/src/common/log.c
index f275d025f..f227ebc39 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -105,7 +105,7 @@ static int log_tor_version(logfile_t *lf, int reset)
tor_snprintf(buf+n, sizeof(buf)-n,
"Tor %s opening %slog file.\n", VERSION, is_new?"new ":"");
if (fputs(buf, lf->file) == EOF ||
- fflush(lf->file) == EOF) /* error */
+ fflush(lf->file) == EOF) /* error */
return -1; /* failed */
return 0;
}
@@ -189,7 +189,7 @@ logv(int severity, const char *funcname, const char *format, va_list ap)
continue;
}
if (fputs(buf, lf->file) == EOF ||
- fflush(lf->file) == EOF) { /* error */
+ fflush(lf->file) == EOF) { /* error */
/* don't log the error! Blow away this log entry and continue. */
logfile_t *victim = lf;
lf = victim->next;
diff --git a/src/common/util.c b/src/common/util.c
index 055dfbcc5..f8eb3019a 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1208,7 +1208,7 @@ parse_addr_and_port_range(const char *s, uint32_t *addr_out,
} else {
endptr = NULL;
*port_min_out = (uint16_t) tor_parse_long(port, 10, 1, 65535,
- NULL, &endptr);
+ NULL, &endptr);
if (*endptr == '-') {
port = endptr+1;
endptr = NULL;
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 23b0e49d3..feac6d043 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -490,7 +490,7 @@ int fetch_from_buf_socks(buf_t *buf, socks_request_t *req) {
return 0; /* not yet */
req->command = (unsigned char) *(buf->mem+1);
if (req->command != SOCKS_COMMAND_CONNECT &&
- req->command != SOCKS_COMMAND_RESOLVE) {
+ req->command != SOCKS_COMMAND_RESOLVE) {
/* not a connect or resolve? we don't support it. */
log_fn(LOG_WARN,"socks5: command %d not recognized. Rejecting.",
req->command);
@@ -548,7 +548,7 @@ int fetch_from_buf_socks(buf_t *buf, socks_request_t *req) {
req->command = (unsigned char) *(buf->mem+1);
if (req->command != SOCKS_COMMAND_CONNECT &&
- req->command != SOCKS_COMMAND_RESOLVE) {
+ req->command != SOCKS_COMMAND_RESOLVE) {
/* not a connect or resolve? we don't support it. */
log_fn(LOG_WARN,"socks4: command %d not recognized. Rejecting.",
req->command);
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 6bdb516b9..10c7bf0d3 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -281,7 +281,7 @@ circuit_t *circuit_establish_circuit(uint8_t purpose,
}
if (onion_extend_cpath(&circ->cpath, circ->build_state, &firsthop)<0 ||
- !CIRCUIT_IS_ORIGIN(circ)) {
+ !CIRCUIT_IS_ORIGIN(circ)) {
log_fn(LOG_INFO,"Generating first cpath hop failed.");
circuit_mark_for_close(circ);
return NULL;
@@ -345,9 +345,9 @@ void circuit_n_conn_done(connection_t *or_conn, int status) {
if (circ->marked_for_close)
continue;
if (!circ->n_conn &&
- circ->n_addr == or_conn->addr &&
- circ->n_port == or_conn->port &&
- !memcmp(or_conn->identity_digest, circ->n_conn_id_digest, DIGEST_LEN)) {
+ circ->n_addr == or_conn->addr &&
+ circ->n_port == or_conn->port &&
+ !memcmp(or_conn->identity_digest, circ->n_conn_id_digest, DIGEST_LEN)) {
tor_assert(circ->state == CIRCUIT_STATE_OR_WAIT);
if (!status) { /* or_conn failed; close circ */
log_fn(LOG_INFO,"or_conn failed. Closing circ.");
@@ -434,8 +434,8 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
}
if (onion_skin_create(router->onion_pkey,
- &(circ->cpath->handshake_state),
- payload) < 0) {
+ &(circ->cpath->handshake_state),
+ payload) < 0) {
log_fn(LOG_WARN,"onion_skin_create (first hop) failed.");
return -1;
}
@@ -486,7 +486,7 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
/* send it to hop->prev, because it will transfer
* it to a create cell and then send to hop */
if (connection_edge_send_command(NULL, circ, RELAY_COMMAND_EXTEND,
- payload, payload_len, hop->prev) < 0)
+ payload, payload_len, hop->prev) < 0)
return 0; /* circuit is closed */
hop->state = CPATH_STATE_AWAITING_KEYS;
@@ -607,7 +607,7 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse)
return -1;
}
if (!(cpath->b_crypto =
- crypto_create_init_cipher(key_data+(2*DIGEST_LEN)+CIPHER_KEY_LEN,0))) {
+ crypto_create_init_cipher(key_data+(2*DIGEST_LEN)+CIPHER_KEY_LEN,0))) {
log(LOG_WARN,"backward cipher initialization failed.");
return -1;
}
@@ -651,7 +651,7 @@ int circuit_finish_handshake(circuit_t *circ, char *reply) {
tor_assert(hop->state == CPATH_STATE_AWAITING_KEYS);
if (onion_skin_client_handshake(hop->handshake_state, reply, keys,
- DIGEST_LEN*2+CIPHER_KEY_LEN*2) < 0) {
+ DIGEST_LEN*2+CIPHER_KEY_LEN*2) < 0) {
log_fn(LOG_WARN,"onion_skin_client_handshake failed.");
return -1;
}
@@ -879,7 +879,7 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
continue; /* skip routers that are known to be down */
}
if (!router->is_verified &&
- (!(options->_AllowUnverified & ALLOW_UNVERIFIED_EXIT) ||
+ (!(options->_AllowUnverified & ALLOW_UNVERIFIED_EXIT) ||
router_is_unreliable_router(router, 1, 1))) {
/* if it's unverified, and either we don't want it or it's unsuitable */
n_supported[i] = -1;
@@ -894,7 +894,7 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
continue; /* skip routers that reject all */
}
if (smartlist_len(preferredentries)==1 &&
- router == (routerinfo_t*)smartlist_get(preferredentries, 0)) {
+ router == (routerinfo_t*)smartlist_get(preferredentries, 0)) {
n_supported[i] = -1;
log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- it's our only preferred entry node.", router->nickname, i);
continue;
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 9edbecc4f..ac7a810da 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -317,10 +317,12 @@ circuit_get_youngest_clean_open(uint8_t purpose) {
circuit_t *youngest=NULL;
for (circ=global_circuitlist;circ;circ = circ->next) {
- if (CIRCUIT_IS_ORIGIN(circ) && circ->state == CIRCUIT_STATE_OPEN &&
- !circ->marked_for_close && circ->purpose == purpose &&
- !circ->timestamp_dirty &&
- (!youngest || youngest->timestamp_created < circ->timestamp_created))
+ if (CIRCUIT_IS_ORIGIN(circ) &&
+ circ->state == CIRCUIT_STATE_OPEN &&
+ !circ->marked_for_close &&
+ circ->purpose == purpose &&
+ !circ->timestamp_dirty &&
+ (!youngest || youngest->timestamp_created < circ->timestamp_created))
youngest = circ;
}
return youngest;
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 159b0cb91..9ab165c6f 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -89,7 +89,7 @@ static int circuit_is_acceptable(circuit_t *circ,
}
} else { /* not general */
if (rend_cmp_service_ids(conn->rend_query, circ->rend_query) &&
- (circ->rend_query[0] || purpose != CIRCUIT_PURPOSE_C_REND_JOINED)) {
+ (circ->rend_query[0] || purpose != CIRCUIT_PURPOSE_C_REND_JOINED)) {
/* this circ is not for this conn, and it's not suitable
* for cannibalizing either */
return 0;
@@ -111,11 +111,11 @@ static int circuit_is_better(circuit_t *a, circuit_t *b, uint8_t purpose)
*/
if (b->timestamp_dirty) {
if (a->timestamp_dirty &&
- a->timestamp_dirty > b->timestamp_dirty)
+ a->timestamp_dirty > b->timestamp_dirty)
return 1;
} else {
if (a->timestamp_dirty ||
- a->timestamp_created > b->timestamp_created)
+ a->timestamp_created > b->timestamp_created)
return 1;
}
break;
@@ -199,7 +199,7 @@ void circuit_expire_building(time_t now) {
/* some debug logs, to help track bugs */
if (victim->purpose >= CIRCUIT_PURPOSE_C_INTRODUCING &&
- victim->purpose <= CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) {
+ victim->purpose <= CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) {
if (!victim->timestamp_dirty)
log_fn(LOG_DEBUG,"Considering %sopen purp %d to %s (circid %d). (clean).",
victim->state == CIRCUIT_STATE_OPEN ? "" : "non",
@@ -216,25 +216,25 @@ void circuit_expire_building(time_t now) {
/* if circ is !open, or if it's open but purpose is a non-finished
* intro or rend, then mark it for close */
if (victim->state != CIRCUIT_STATE_OPEN ||
- victim->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND ||
- victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCING ||
- victim->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO ||
-
- /* it's a rend_ready circ, but it's already picked a query */
- (victim->purpose == CIRCUIT_PURPOSE_C_REND_READY &&
- victim->rend_query[0]) ||
-
- /* c_rend_ready circs measure age since timestamp_dirty,
- * because that's set when they switch purposes
- */
- /* rend and intro circs become dirty each time they
- * make an introduction attempt. so timestamp_dirty
- * will reflect the time since the last attempt.
- */
- ((victim->purpose == CIRCUIT_PURPOSE_C_REND_READY ||
- victim->purpose == CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED ||
- victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) &&
- victim->timestamp_dirty + MIN_SECONDS_BEFORE_EXPIRING_CIRC > now)) {
+ victim->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND ||
+ victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCING ||
+ victim->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO ||
+
+ /* it's a rend_ready circ, but it's already picked a query */
+ (victim->purpose == CIRCUIT_PURPOSE_C_REND_READY &&
+ victim->rend_query[0]) ||
+
+ /* c_rend_ready circs measure age since timestamp_dirty,
+ * because that's set when they switch purposes
+ */
+ /* rend and intro circs become dirty each time they
+ * make an introduction attempt. so timestamp_dirty
+ * will reflect the time since the last attempt.
+ */
+ ((victim->purpose == CIRCUIT_PURPOSE_C_REND_READY ||
+ victim->purpose == CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED ||
+ victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) &&
+ victim->timestamp_dirty + MIN_SECONDS_BEFORE_EXPIRING_CIRC > now)) {
if (victim->n_conn)
log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s, purpose %d)",
victim->n_conn->address, victim->n_port, victim->n_circ_id,
@@ -264,10 +264,12 @@ int circuit_stream_is_being_handled(connection_t *conn) {
time_t now = time(NULL);
for (circ=global_circuitlist;circ;circ = circ->next) {
- if (CIRCUIT_IS_ORIGIN(circ) && circ->state != CIRCUIT_STATE_OPEN &&
- !circ->marked_for_close && circ->purpose == CIRCUIT_PURPOSE_C_GENERAL &&
- (!circ->timestamp_dirty ||
- circ->timestamp_dirty + get_options()->NewCircuitPeriod < now)) {
+ if (CIRCUIT_IS_ORIGIN(circ) &&
+ circ->state != CIRCUIT_STATE_OPEN &&
+ !circ->marked_for_close &&
+ circ->purpose == CIRCUIT_PURPOSE_C_GENERAL &&
+ (!circ->timestamp_dirty ||
+ circ->timestamp_dirty + get_options()->NewCircuitPeriod < now)) {
exitrouter = router_get_by_digest(circ->build_state->chosen_exit_digest);
if (exitrouter && connection_ap_can_use_exit(conn, exitrouter))
if (++num >= MIN_CIRCUITS_HANDLING_STREAM)
@@ -305,8 +307,9 @@ void circuit_build_needed_circs(time_t now) {
client_dns_clean();
circuit_expire_old_circuits();
- if (get_options()->RunTesting && circ &&
- circ->timestamp_created + TESTING_CIRCUIT_INTERVAL < now) {
+ if (get_options()->RunTesting &&
+ circ &&
+ circ->timestamp_created + TESTING_CIRCUIT_INTERVAL < now) {
log_fn(LOG_INFO,"Creating a new testing circuit.");
circuit_launch_by_identity(CIRCUIT_PURPOSE_C_GENERAL, NULL);
}
@@ -320,7 +323,7 @@ void circuit_build_needed_circs(time_t now) {
/* if there's no open circ, and less than 5 are on the way,
* go ahead and try another. */
if (!circ && circuit_count_building(CIRCUIT_PURPOSE_C_GENERAL)
- < CIRCUIT_MIN_BUILDING_GENERAL) {
+ < CIRCUIT_MIN_BUILDING_GENERAL) {
circuit_launch_by_identity(CIRCUIT_PURPOSE_C_GENERAL, NULL);
}
@@ -720,7 +723,7 @@ circuit_get_open_circ_or_launch(connection_t *conn,
tor_free(exitname);
if (circ &&
- (desired_circuit_purpose != CIRCUIT_PURPOSE_C_GENERAL)) {
+ desired_circuit_purpose != CIRCUIT_PURPOSE_C_GENERAL) {
/* then write the service_id into circ */
strlcpy(circ->rend_query, conn->rend_query, sizeof(circ->rend_query));
}
diff --git a/src/or/connection.c b/src/or/connection.c
index 7eb77fb5e..add670ea3 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -713,11 +713,11 @@ static void connection_consider_empty_buckets(connection_t *conn) {
return;
}
if (connection_speaks_cells(conn) &&
- conn->state == OR_CONN_STATE_OPEN &&
- conn->receiver_bucket == 0) {
- log_fn(LOG_DEBUG,"receiver bucket exhausted. Pausing.");
- conn->wants_to_read = 1;
- connection_stop_reading(conn);
+ conn->state == OR_CONN_STATE_OPEN &&
+ conn->receiver_bucket == 0) {
+ log_fn(LOG_DEBUG,"receiver bucket exhausted. Pausing.");
+ conn->wants_to_read = 1;
+ connection_stop_reading(conn);
}
}
@@ -757,12 +757,12 @@ void connection_bucket_refill(struct timeval *now) {
}
if (conn->wants_to_read == 1 /* it's marked to turn reading back on now */
- && global_read_bucket > 0 /* and we're allowed to read */
- && global_write_bucket > 0 /* and we're allowed to write (XXXX,
- * not the best place to check this.) */
- && (!connection_speaks_cells(conn) ||
- conn->state != OR_CONN_STATE_OPEN ||
- conn->receiver_bucket > 0)) {
+ && global_read_bucket > 0 /* and we're allowed to read */
+ && global_write_bucket > 0 /* and we're allowed to write (XXXX,
+ * not the best place to check this.) */
+ && (!connection_speaks_cells(conn) ||
+ conn->state != OR_CONN_STATE_OPEN ||
+ conn->receiver_bucket > 0)) {
/* and either a non-cell conn or a cell conn with non-empty bucket */
log_fn(LOG_DEBUG,"waking up conn (fd %d)",conn->s);
conn->wants_to_read = 0;
@@ -839,7 +839,7 @@ loop_again:
/* XXX I suspect pollerr may make Windows not get to this point. :( */
router_mark_as_down(conn->identity_digest);
if (conn->purpose == DIR_PURPOSE_FETCH_DIR &&
- !all_trusted_directory_servers_down()) {
+ !all_trusted_directory_servers_down()) {
log_fn(LOG_INFO,"Giving up on dirserver %s; trying another.", conn->address);
directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL);
}
@@ -1117,7 +1117,7 @@ connection_t *connection_exact_get_by_addr_port(uint32_t addr, uint16_t port) {
for (i=0;i<n;i++) {
conn = carray[i];
if (conn->addr == addr && conn->port == port && !conn->marked_for_close &&
- (!best || best->timestamp_created < conn->timestamp_created))
+ (!best || best->timestamp_created < conn->timestamp_created))
best = conn;
}
return best;
@@ -1134,9 +1134,9 @@ connection_t *connection_get_by_identity_digest(const char *digest, int type)
conn = carray[i];
if (conn->type != type)
continue;
- if (!memcmp(conn->identity_digest, digest, DIGEST_LEN)
- && !conn->marked_for_close
- && (!best || best->timestamp_created < conn->timestamp_created))
+ if (!memcmp(conn->identity_digest, digest, DIGEST_LEN) &&
+ !conn->marked_for_close &&
+ (!best || best->timestamp_created < conn->timestamp_created))
best = conn;
}
return best;
@@ -1207,8 +1207,8 @@ connection_t *connection_get_by_type_rendquery(int type, const char *rendquery)
for (i=0;i<n;i++) {
conn = carray[i];
if (conn->type == type &&
- !conn->marked_for_close &&
- !rend_cmp_service_ids(rendquery, conn->rend_query))
+ !conn->marked_for_close &&
+ !rend_cmp_service_ids(rendquery, conn->rend_query))
return conn;
}
return NULL;
@@ -1217,9 +1217,9 @@ connection_t *connection_get_by_type_rendquery(int type, const char *rendquery)
/** Return 1 if <b>conn</b> is a listener conn, else return 0. */
int connection_is_listener(connection_t *conn) {
if (conn->type == CONN_TYPE_OR_LISTENER ||
- conn->type == CONN_TYPE_AP_LISTENER ||
- conn->type == CONN_TYPE_DIR_LISTENER ||
- conn->type == CONN_TYPE_CONTROL_LISTENER)
+ conn->type == CONN_TYPE_AP_LISTENER ||
+ conn->type == CONN_TYPE_DIR_LISTENER ||
+ conn->type == CONN_TYPE_CONTROL_LISTENER)
return 1;
return 0;
}
@@ -1234,9 +1234,9 @@ int connection_state_is_open(connection_t *conn) {
return 0;
if ((conn->type == CONN_TYPE_OR && conn->state == OR_CONN_STATE_OPEN) ||
- (conn->type == CONN_TYPE_AP && conn->state == AP_CONN_STATE_OPEN) ||
- (conn->type == CONN_TYPE_EXIT && conn->state == EXIT_CONN_STATE_OPEN) ||
- (conn->type == CONN_TYPE_CONTROL && conn->state ==CONTROL_CONN_STATE_OPEN))
+ (conn->type == CONN_TYPE_AP && conn->state == AP_CONN_STATE_OPEN) ||
+ (conn->type == CONN_TYPE_EXIT && conn->state == EXIT_CONN_STATE_OPEN) ||
+ (conn->type == CONN_TYPE_CONTROL && conn->state ==CONTROL_CONN_STATE_OPEN))
return 1;
return 0;
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index bf1074152..883413292 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -213,12 +213,12 @@ int connection_edge_finished_connecting(connection_t *conn)
/* deliver a 'connected' relay cell back through the circuit. */
if (connection_edge_is_rendezvous_stream(conn)) {
if (connection_edge_send_command(conn, circuit_get_by_conn(conn),
- RELAY_COMMAND_CONNECTED, NULL, 0, conn->cpath_layer) < 0)
+ RELAY_COMMAND_CONNECTED, NULL, 0, conn->cpath_layer) < 0)
return 0; /* circuit is closed, don't continue */
} else {
*(uint32_t*)connected_payload = htonl(conn->addr);
if (connection_edge_send_command(conn, circuit_get_by_conn(conn),
- RELAY_COMMAND_CONNECTED, connected_payload, 4, conn->cpath_layer) < 0)
+ RELAY_COMMAND_CONNECTED, connected_payload, 4, conn->cpath_layer) < 0)
return 0; /* circuit is closed, don't continue */
}
tor_assert(conn->package_window > 0);
@@ -515,7 +515,7 @@ int connection_ap_handshake_send_begin(connection_t *ap_conn, circuit_t *circ)
log_fn(LOG_DEBUG,"Sending relay cell to begin stream %d.",ap_conn->stream_id);
if (connection_edge_send_command(ap_conn, circ, RELAY_COMMAND_BEGIN,
- payload, payload_len, ap_conn->cpath_layer) < 0)
+ payload, payload_len, ap_conn->cpath_layer) < 0)
return -1; /* circuit is closed, don't continue */
ap_conn->package_window = STREAMWINDOW_START;
@@ -1000,8 +1000,8 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit)
return tor_version_as_new_as(exit->platform, "0.0.9pre1");
}
addr = client_dns_lookup_entry(conn->socks_request->address);
- if (router_compare_addr_to_addr_policy(addr,
- conn->socks_request->port, exit->exit_policy) < 0)
+ if (router_compare_addr_to_addr_policy(addr, conn->socks_request->port,
+ exit->exit_policy) < 0)
return 0;
return 1;
}
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 0facd1aa5..719cf20c8 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -208,7 +208,7 @@ connection_t *connection_or_connect(uint32_t addr, uint16_t port,
tor_assert(id_digest);
if (server_mode(get_options()) && (me=router_get_my_routerinfo()) &&
- !memcmp(me->identity_digest, id_digest,DIGEST_LEN)) {
+ !memcmp(me->identity_digest, id_digest,DIGEST_LEN)) {
log_fn(LOG_WARN,"Request to connect to myself! Failing.");
return NULL;
}
@@ -385,8 +385,8 @@ connection_tls_finish_handshake(connection_t *conn) {
router = router_get_by_nickname(nickname);
if (router && /* we know this nickname */
- router->is_verified && /* make sure it's the right guy */
- memcmp(digest_rcvd, router->identity_digest, DIGEST_LEN) != 0) {
+ router->is_verified && /* make sure it's the right guy */
+ memcmp(digest_rcvd, router->identity_digest, DIGEST_LEN) != 0) {
log_fn(LOG_WARN, "Identity key not as expected for router claiming to be '%s' (%s:%d) ", nickname, conn->address, conn->port);
return -1;
}
@@ -455,7 +455,7 @@ void connection_or_write_cell_to_buf(const cell_t *cell, connection_t *conn) {
* during periods of high load we won't read the entire megabyte from
* input before pushing any data out. */
if (conn->outbuf_flushlen-CELL_NETWORK_SIZE < MIN_TLS_FLUSHLEN &&
- conn->outbuf_flushlen >= MIN_TLS_FLUSHLEN) {
+ conn->outbuf_flushlen >= MIN_TLS_FLUSHLEN) {
int extra = conn->outbuf_flushlen - MIN_TLS_FLUSHLEN;
conn->outbuf_flushlen = MIN_TLS_FLUSHLEN;
if (connection_handle_write(conn) < 0) {
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 1daf10e33..c91665c1e 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -235,7 +235,7 @@ static int cpuworker_main(void *data) {
if (question_type == CPUWORKER_TASK_ONION) {
if (onion_skin_server_handshake(question, onion_key, last_onion_key,
- reply_to_proxy, keys, 40+32) < 0) {
+ reply_to_proxy, keys, 40+32) < 0) {
/* failure */
log_fn(LOG_WARN,"onion_skin_server_handshake failed.");
memset(buf,0,LEN_ONION_RESPONSE); /* send all zeros for failure */
diff --git a/src/or/directory.c b/src/or/directory.c
index 45327d5df..4c2db63f3 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -277,14 +277,14 @@ directory_initiate_command(const char *address, uint32_t addr,
conn->state = DIR_CONN_STATE_CONNECTING;
if (purpose == DIR_PURPOSE_FETCH_DIR ||
- purpose == DIR_PURPOSE_UPLOAD_DIR ||
- purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
+ purpose == DIR_PURPOSE_UPLOAD_DIR ||
+ purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
/* then we want to connect directly */
switch (connection_connect(conn, conn->address, addr, dir_port)) {
case -1:
router_mark_as_down(conn->identity_digest); /* don't try him again */
if (purpose == DIR_PURPOSE_FETCH_DIR &&
- !all_trusted_directory_servers_down()) {
+ !all_trusted_directory_servers_down()) {
log_fn(LOG_INFO,"Giving up on dirserver '%s'; trying another.", conn->address);
directory_get_from_dirserver(purpose, NULL);
}
@@ -475,8 +475,8 @@ parse_http_response(const char *headers, int *code, time_t *date,
while (isspace((int)*headers)) headers++; /* tolerate leading whitespace */
if (sscanf(headers, "HTTP/1.%d %d", &n1, &n2) < 2 ||
- (n1 != 0 && n1 != 1) ||
- (n2 < 100 || n2 >= 600)) {
+ (n1 != 0 && n1 != 1) ||
+ (n2 < 100 || n2 >= 600)) {
log_fn(LOG_WARN,"Failed to parse header '%s'",headers);
return -1;
}
@@ -538,8 +538,8 @@ connection_dir_client_reached_eof(connection_t *conn)
int compression;
switch (fetch_from_buf_http(conn->inbuf,
- &headers, MAX_HEADERS_SIZE,
- &body, &body_len, MAX_DIR_SIZE)) {
+ &headers, MAX_HEADERS_SIZE,
+ &body, &body_len, MAX_DIR_SIZE)) {
case -1: /* overflow */
log_fn(LOG_WARN,"'fetch' response too large. Failing.");
return -1;
@@ -550,7 +550,7 @@ connection_dir_client_reached_eof(connection_t *conn)
}
if (parse_http_response(headers, &status_code, &date_header,
- &compression) < 0) {
+ &compression) < 0) {
log_fn(LOG_WARN,"Unparseable headers. Closing.");
tor_free(body); tor_free(headers);
return -1;
@@ -782,7 +782,7 @@ directory_handle_command_get(connection_t *conn, char *headers,
}
if (!strcmp(url,"/tor/running-routers") ||
- !strcmp(url,"/tor/running-routers.z")) { /* running-routers fetch */
+ !strcmp(url,"/tor/running-routers.z")) { /* running-routers fetch */
int deflated = !strcmp(url,"/tor/dir.z");
tor_free(url);
if (!authdir_mode(get_options())) {
@@ -926,8 +926,8 @@ static int directory_handle_command(connection_t *conn) {
tor_assert(conn->type == CONN_TYPE_DIR);
switch (fetch_from_buf_http(conn->inbuf,
- &headers, MAX_HEADERS_SIZE,
- &body, &body_len, MAX_BODY_SIZE)) {
+ &headers, MAX_HEADERS_SIZE,
+ &body, &body_len, MAX_BODY_SIZE)) {
case -1: /* overflow */
log_fn(LOG_WARN,"Invalid input. Closing.");
return -1;
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index c8e0124b6..f49df40ff 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -114,7 +114,7 @@ dirserv_parse_fingerprint_file(const char *fname)
continue;
}
if (strlen(fingerprint) != FINGERPRINT_LEN ||
- !crypto_pk_check_fingerprint_syntax(fingerprint)) {
+ !crypto_pk_check_fingerprint_syntax(fingerprint)) {
log_fn(LOG_WARN, "Invalid fingerprint (nickname '%s', fingerprint %s). Skipping.",
nickname, fingerprint);
continue;
diff --git a/src/or/dns.c b/src/or/dns.c
index 1fa39caee..2991dcd72 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -353,8 +353,8 @@ void assert_connection_edge_not_dns_pending(connection_t *conn) {
SPLAY_FOREACH(resolve, cache_tree, &cache_root) {
for (pend = resolve->pending_connections;
- pend;
- pend = pend->next) {
+ pend;
+ pend = pend->next) {
tor_assert(pend->conn != conn);
}
}
@@ -368,8 +368,8 @@ void assert_all_pending_dns_resolves_ok(void) {
SPLAY_FOREACH(resolve, cache_tree, &cache_root) {
for (pend = resolve->pending_connections;
- pend;
- pend = pend->next) {
+ pend;
+ pend = pend->next) {
assert_connection_ok(pend->conn, 0);
tor_assert(pend->conn->s == -1);
tor_assert(!connection_in_array(pend->conn));
diff --git a/src/or/main.c b/src/or/main.c
index 34576f4c2..8c7cef413 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -252,7 +252,7 @@ static void conn_read(int i) {
* should be a &&.
*/
if (!connection_is_reading(conn) ||
- !connection_has_pending_tls_data(conn))
+ !connection_has_pending_tls_data(conn))
return; /* this conn should not read */
log_fn(LOG_DEBUG,"socket %d wants to read.",conn->s);
@@ -263,15 +263,15 @@ static void conn_read(int i) {
if (
/* XXX does POLLHUP also mean it's definitely broken? */
#ifdef MS_WINDOWS
- (poll_array[i].revents & POLLERR) ||
+ (poll_array[i].revents & POLLERR) ||
#endif
- connection_handle_read(conn) < 0) {
- if (!conn->marked_for_close) {
- /* this connection is broken. remove it */
- log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing",
- CONN_TYPE_TO_STRING(conn->type), conn->s);
- connection_mark_for_close(conn);
- }
+ connection_handle_read(conn) < 0) {
+ if (!conn->marked_for_close) {
+ /* this connection is broken. remove it */
+ log_fn(LOG_WARN,"Unhandled error on read for %s connection (fd %d); removing",
+ CONN_TYPE_TO_STRING(conn->type), conn->s);
+ connection_mark_for_close(conn);
+ }
}
assert_connection_ok(conn, time(NULL));
assert_all_pending_dns_resolves_ok();
@@ -411,8 +411,8 @@ static void run_connection_housekeeping(int i, time_t now) {
/* Expire any directory connections that haven't sent anything for 5 min */
if (conn->type == CONN_TYPE_DIR &&
- !conn->marked_for_close &&
- conn->timestamp_lastwritten + 5*60 < now) {
+ !conn->marked_for_close &&
+ conn->timestamp_lastwritten + 5*60 < now) {
log_fn(LOG_INFO,"Expiring wedged directory conn (fd %d, purpose %d)", conn->s, conn->purpose);
connection_mark_for_close(conn);
return;
@@ -421,12 +421,12 @@ static void run_connection_housekeeping(int i, time_t now) {
/* If we haven't written to an OR connection for a while, then either nuke
the connection or send a keepalive, depending. */
if (connection_speaks_cells(conn) &&
- now >= conn->timestamp_lastwritten + options->KeepalivePeriod) {
+ now >= conn->timestamp_lastwritten + options->KeepalivePeriod) {
routerinfo_t *router = router_get_by_digest(conn->identity_digest);
if ((!connection_state_is_open(conn)) ||
- (we_are_hibernating() && !circuit_get_by_conn(conn)) ||
- (!clique_mode(options) && !circuit_get_by_conn(conn) &&
- (!router || !server_mode(options) || !router_is_clique_mode(router)))) {
+ (we_are_hibernating() && !circuit_get_by_conn(conn)) ||
+ (!clique_mode(options) && !circuit_get_by_conn(conn) &&
+ (!router || !server_mode(options) || !router_is_clique_mode(router)))) {
/* our handshake has expired; we're hibernating;
* or we have no circuits and we're both either OPs or normal ORs,
* then kill it. */
@@ -727,7 +727,7 @@ static int prepare_for_poll(void) {
for (i=0;i<nfds;i++) {
conn = connection_array[i];
if (connection_has_pending_tls_data(conn) &&
- connection_is_reading(conn)) {
+ connection_is_reading(conn)) {
log_fn(LOG_DEBUG,"sock %d has pending bytes.",conn->s);
return 0; /* has pending bytes to read; don't let poll wait. */
}
@@ -1174,24 +1174,23 @@ void nt_service_body(int argc, char **argv)
service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
service_status.dwCurrentState = SERVICE_START_PENDING;
service_status.dwControlsAccepted =
- SERVICE_ACCEPT_STOP |
- SERVICE_ACCEPT_SHUTDOWN;
+ SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
service_status.dwWin32ExitCode = 0;
service_status.dwServiceSpecificExitCode = 0;
service_status.dwCheckPoint = 0;
service_status.dwWaitHint = 1000;
hStatus = RegisterServiceCtrlHandler(GENSRV_SERVICENAME, (LPHANDLER_FUNCTION) nt_service_control);
if (hStatus == 0) {
- // failed;
- return;
+ // failed;
+ return;
}
err = tor_init(backup_argc, backup_argv); // refactor this part out of tor_main and do_main_loop
if (err) {
- // failed.
- service_status.dwCurrentState = SERVICE_STOPPED;
- service_status.dwWin32ExitCode = -1;
+ // failed.
+ service_status.dwCurrentState = SERVICE_STOPPED;
+ service_status.dwWin32ExitCode = -1;
SetServiceStatus(hStatus, &service_status);
- return;
+ return;
}
service_status.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus(hStatus, &service_status);
@@ -1280,13 +1279,13 @@ int nt_service_install()
}
if ((hService = CreateService(hSCManager, GENSRV_SERVICENAME, GENSRV_DISPLAYNAME,
- SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START,
- SERVICE_ERROR_IGNORE, command, NULL, NULL,
- NULL, NULL, NULL)) == NULL) {
- printf("Failed: CreateService()\n");
- CloseServiceHandle(hSCManager);
- free(command);
- return 0;
+ SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
+ SERVICE_DEMAND_START, SERVICE_ERROR_IGNORE, command,
+ NULL, NULL, NULL, NULL, NULL)) == NULL) {
+ printf("Failed: CreateService()\n");
+ CloseServiceHandle(hSCManager);
+ free(command);
+ return 0;
}
CloseServiceHandle(hService);
diff --git a/src/or/relay.c b/src/or/relay.c
index 1e257d4f6..fd77a92f6 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -111,7 +111,7 @@ static int relay_crypt_one_payload(crypto_cipher_env_t *cipher, char *in,
relay_header_unpack(&rh, in);
// log_fn(LOG_DEBUG,"before crypt: %d",rh.recognized);
if (( encrypt_mode && crypto_cipher_encrypt(cipher, out, in, CELL_PAYLOAD_SIZE)) ||
- (!encrypt_mode && crypto_cipher_decrypt(cipher, out, in, CELL_PAYLOAD_SIZE))) {
+ (!encrypt_mode && crypto_cipher_decrypt(cipher, out, in, CELL_PAYLOAD_SIZE))) {
log_fn(LOG_WARN,"Error during relay encryption");
return -1;
}
@@ -351,7 +351,7 @@ relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction)
if (rh.stream_id == tmpconn->stream_id) {
log_fn(LOG_DEBUG,"found conn for stream %d.", rh.stream_id);
if (cell_direction == CELL_DIRECTION_OUT ||
- connection_edge_is_rendezvous_stream(tmpconn))
+ connection_edge_is_rendezvous_stream(tmpconn))
return tmpconn;
}
}
@@ -655,8 +655,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
* conn points to the recognized stream. */
if (conn &&
- conn->state != AP_CONN_STATE_OPEN &&
- conn->state != EXIT_CONN_STATE_OPEN) {
+ conn->state != AP_CONN_STATE_OPEN &&
+ conn->state != EXIT_CONN_STATE_OPEN) {
return connection_edge_process_relay_cell_not_open(
&rh, cell, circ, conn, layer_hint);
}
@@ -679,8 +679,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
case RELAY_COMMAND_DATA:
++stats_n_data_cells_received;
- if ((layer_hint && --layer_hint->deliver_window < 0) ||
- (!layer_hint && --circ->deliver_window < 0)) {
+ if (( layer_hint && --layer_hint->deliver_window < 0) ||
+ (!layer_hint && --circ->deliver_window < 0)) {
log_fn(LOG_WARN,"(relay data) circ deliver_window below 0. Killing.");
connection_edge_end(conn, END_STREAM_REASON_MISC, conn->cpath_layer);
connection_mark_for_close(conn);
@@ -910,7 +910,7 @@ repeat_connection_edge_package_raw_inbuf:
}
if (connection_edge_send_command(conn, circ, RELAY_COMMAND_DATA,
- payload, length, conn->cpath_layer) < 0)
+ payload, length, conn->cpath_layer) < 0)
return 0; /* circuit is closed, don't continue */
if (!conn->cpath_layer) { /* non-rendezvous exit */
@@ -957,7 +957,7 @@ void connection_edge_consider_sending_sendme(connection_t *conn) {
log_fn(LOG_DEBUG,"Outbuf %d, Queueing stream sendme.", (int)conn->outbuf_flushlen);
conn->deliver_window += STREAMWINDOW_INCREMENT;
if (connection_edge_send_command(conn, circ, RELAY_COMMAND_SENDME,
- NULL, 0, conn->cpath_layer) < 0) {
+ NULL, 0, conn->cpath_layer) < 0) {
log_fn(LOG_WARN,"connection_edge_send_command failed. Returning.");
return; /* the circuit's closed, don't continue */
}
@@ -991,7 +991,7 @@ circuit_resume_edge_reading_helper(connection_t *conn,
for ( ; conn; conn=conn->next_stream) {
if ((!layer_hint && conn->package_window > 0) ||
- (layer_hint && conn->package_window > 0 && conn->cpath_layer == layer_hint)) {
+ (layer_hint && conn->package_window > 0 && conn->cpath_layer == layer_hint)) {
connection_start_reading(conn);
/* handle whatever might still be on the inbuf */
connection_edge_package_raw_inbuf(conn, 1);
@@ -1054,14 +1054,14 @@ circuit_consider_sending_sendme(circuit_t *circ, crypt_path_t *layer_hint)
// log_fn(LOG_INFO,"Considering: layer_hint is %s",
// layer_hint ? "defined" : "null");
while ((layer_hint ? layer_hint->deliver_window : circ->deliver_window) <
- CIRCWINDOW_START - CIRCWINDOW_INCREMENT) {
+ CIRCWINDOW_START - CIRCWINDOW_INCREMENT) {
log_fn(LOG_DEBUG,"Queueing circuit sendme.");
if (layer_hint)
layer_hint->deliver_window += CIRCWINDOW_INCREMENT;
else
circ->deliver_window += CIRCWINDOW_INCREMENT;
if (connection_edge_send_command(NULL, circ, RELAY_COMMAND_SENDME,
- NULL, 0, layer_hint) < 0) {
+ NULL, 0, layer_hint) < 0) {
log_fn(LOG_WARN,"connection_edge_send_command failed. Circuit's closed.");
return; /* the circuit's closed, don't continue */
}
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 8ed850951..d89c3ba7c 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -205,7 +205,7 @@ rend_client_introduction_acked(circuit_t *circ,
* If none remain, refetch the service descriptor.
*/
if (rend_client_remove_intro_point(circ->build_state->chosen_exit_name,
- circ->rend_query) > 0) {
+ circ->rend_query) > 0) {
/* There are introduction points left. re-extend the circuit to
* another intro point and try again. */
routerinfo_t *r;
@@ -315,7 +315,7 @@ rend_client_receive_rendezvous(circuit_t *circ, const char *request, size_t requ
crypt_path_t *hop;
char keys[DIGEST_LEN+CPATH_KEY_MATERIAL_LEN];
- if ( (circ->purpose != CIRCUIT_PURPOSE_C_REND_READY &&
+ if ((circ->purpose != CIRCUIT_PURPOSE_C_REND_READY &&
circ->purpose != CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED)
|| !circ->build_state->pending_final_cpath) {
log_fn(LOG_WARN,"Got rendezvous2 cell from Bob, but not expecting it. Closing.");
diff --git a/src/or/router.c b/src/or/router.c
index f24e2bdcc..0ba606b92 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -191,34 +191,34 @@ crypto_pk_env_t *init_key_from_file(const char *fname)
}
switch (file_status(fname)) {
- case FN_DIR:
- case FN_ERROR:
- log(LOG_ERR, "Can't read key from %s", fname);
- goto error;
- case FN_NOENT:
- log(LOG_INFO, "No key found in %s; generating fresh key.", fname);
- if (crypto_pk_generate_key(prkey)) {
- log(LOG_ERR, "Error generating onion key");
- goto error;
- }
- if (crypto_pk_check_key(prkey) <= 0) {
- log(LOG_ERR, "Generated key seems invalid");
- goto error;
- }
- log(LOG_INFO, "Generated key seems valid");
- if (crypto_pk_write_private_key_to_filename(prkey, fname)) {
- log(LOG_ERR, "Couldn't write generated key to %s.", fname);
- goto error;
- }
- return prkey;
- case FN_FILE:
- if (crypto_pk_read_private_key_from_filename(prkey, fname)) {
- log(LOG_ERR, "Error loading private key.");
+ case FN_DIR:
+ case FN_ERROR:
+ log(LOG_ERR, "Can't read key from %s", fname);
goto error;
- }
- return prkey;
- default:
- tor_assert(0);
+ case FN_NOENT:
+ log(LOG_INFO, "No key found in %s; generating fresh key.", fname);
+ if (crypto_pk_generate_key(prkey)) {
+ log(LOG_ERR, "Error generating onion key");
+ goto error;
+ }
+ if (crypto_pk_check_key(prkey) <= 0) {
+ log(LOG_ERR, "Generated key seems invalid");
+ goto error;
+ }
+ log(LOG_INFO, "Generated key seems valid");
+ if (crypto_pk_write_private_key_to_filename(prkey, fname)) {
+ log(LOG_ERR, "Couldn't write generated key to %s.", fname);
+ goto error;
+ }
+ return prkey;
+ case FN_FILE:
+ if (crypto_pk_read_private_key_from_filename(prkey, fname)) {
+ log(LOG_ERR, "Error loading private key.");
+ goto error;
+ }
+ return prkey;
+ default:
+ tor_assert(0);
}
error:
@@ -402,7 +402,7 @@ void router_retry_connections(void) {
if (!clique_mode(options) && !router_is_clique_mode(router))
continue;
if (!connection_get_by_identity_digest(router->identity_digest,
- CONN_TYPE_OR)) {
+ CONN_TYPE_OR)) {
/* not in the list */
log_fn(LOG_DEBUG,"connecting to OR at %s:%u.",router->address,router->or_port);
connection_or_connect(router->addr, router->or_port, router->identity_digest);
@@ -650,14 +650,14 @@ int router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
/* PEM-encode the onion key */
if (crypto_pk_write_public_key_to_string(router->onion_pkey,
- &onion_pkey,&onion_pkeylen)<0) {
+ &onion_pkey,&onion_pkeylen)<0) {
log_fn(LOG_WARN,"write onion_pkey to string failed!");
return -1;
}
/* PEM-encode the identity key key */
if (crypto_pk_write_public_key_to_string(router->identity_pkey,
- &identity_pkey,&identity_pkeylen)<0) {
+ &identity_pkey,&identity_pkeylen)<0) {
log_fn(LOG_WARN,"write identity_pkey to string failed!");
tor_free(onion_pkey);
return -1;
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index a759ae3b6..b702abdac 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -62,8 +62,8 @@ int router_reload_router_list(void)
log_fn(LOG_WARN, "Cached directory at '%s' was unparseable; ignoring.", filename);
}
if (routerlist &&
- ((routerlist->published_on > time(NULL) - OLD_MIN_ONION_KEY_LIFETIME/2)
- || is_recent)) {
+ ((routerlist->published_on > time(NULL) - OLD_MIN_ONION_KEY_LIFETIME/2)
+ || is_recent)) {
/* XXX use new onion key lifetime when 0.0.8 servers are obsolete */
directory_has_arrived(st.st_mtime); /* do things we've been waiting to do */
}
@@ -354,9 +354,9 @@ router_add_running_routers_to_smartlist(smartlist_t *sl, int allow_unverified,
for (i=0;i<smartlist_len(routerlist->routers);i++) {
router = smartlist_get(routerlist->routers, i);
if (router->is_running &&
- (router->is_verified ||
- (allow_unverified &&
- !router_is_unreliable_router(router, preferuptime, preferbandwidth)))) {
+ (router->is_verified ||
+ (allow_unverified &&
+ !router_is_unreliable_router(router, preferuptime, preferbandwidth)))) {
/* If it's running, and either it's verified or we're ok picking
* unverified routers and this one is suitable.
*/
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 5903e3ddc..8b0e590aa 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -433,10 +433,9 @@ router_parse_routerlist_from_directory(const char *str,
static int have_warned_about_unverified_status = 0;
routerinfo_t *me = router_get_my_routerinfo();
if (me) {
- if (router_update_status_from_smartlist(me, published_on,
- good_nickname_list,
- tok->tp==K_RUNNING_ROUTERS)==1 &&
- me->is_verified == 0 && !have_warned_about_unverified_status) {
+ if (router_update_status_from_smartlist(me,
+ published_on, good_nickname_list, tok->tp==K_RUNNING_ROUTERS)==1 &&
+ me->is_verified == 0 && !have_warned_about_unverified_status) {
log_fn(LOG_WARN,"Dirserver '%s' lists your server as unverified. Please consider sending your identity fingerprint to the tor-ops.", dirnickname);
have_warned_about_unverified_status = 1;
}