aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index dfbd075e6..91b5322bc 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -990,6 +990,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
smartlist_t *which = NULL;
+ int source;
char *cp;
log_info(LD_DIR,"Received networkstatus objects (size %d) from server "
"'%s:%d'",(int) body_len, conn->_base.address, conn->_base.port);
@@ -1006,11 +1007,13 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
note_request(was_compressed?"dl/status.z":"dl/status", orig_len);
if (conn->requested_resource &&
!strcmpstart(conn->requested_resource,"fp/")) {
+ source = NS_FROM_DIR_BY_FP;
which = smartlist_create();
dir_split_resource_into_fingerprints(conn->requested_resource+3,
which, NULL, 0, 0);
} else if (conn->requested_resource &&
!strcmpstart(conn->requested_resource, "all")) {
+ source = NS_FROM_DIR_ALL;
which = smartlist_create();
SMARTLIST_FOREACH(router_get_trusted_dir_servers(),
trusted_dir_server_t *, ds,
@@ -1019,6 +1022,11 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
base16_encode(cp, HEX_DIGEST_LEN+1, ds->digest, DIGEST_LEN);
smartlist_add(which, cp);
});
+ } else {
+ /* Can we even end up here? -- weasel*/
+ source = NS_FROM_DIR_BY_FP;
+ log_warn(LD_BUG, "we received a networkstatus but we did neither ask"
+ "for it by fp/ nor did we ask for all.");
}
cp = body;
while (*cp) {
@@ -1026,7 +1034,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
if (next)
next[1] = '\0';
/* learn from it, and then remove it from 'which' */
- if (router_set_networkstatus(cp, time(NULL), NS_FROM_DIR, which)<0)
+ if (router_set_networkstatus(cp, time(NULL), source, which)<0)
break;
if (next) {
next[1] = 'n';