mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Warn in more detail when network-status serving and fetching fails. Also, fix a small leak.
svn:r4963
This commit is contained in:
parent
42f752a0a5
commit
0de64f224e
@ -892,8 +892,9 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
char *cp;
|
||||
log_fn(LOG_INFO,"Received networkstatus objects (size %d) from server '%s:%d'",(int) body_len, conn->address, conn->port);
|
||||
if (status_code != 200) {
|
||||
log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d'. I'll try again soon.",
|
||||
status_code, reason, conn->address, conn->port);
|
||||
log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d' while fetching \"/tor/status/%s\". I'll try again soon.",
|
||||
status_code, reason, conn->address, conn->port,
|
||||
conn->requested_resource);
|
||||
tor_free(body); tor_free(headers); tor_free(reason);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1028,7 +1028,7 @@ generate_v2_networkstatus(void)
|
||||
|
||||
if (crypto_pk_get_fingerprint(private_key, fingerprint, 0)<0) {
|
||||
log_fn(LOG_ERR, "Error computing fingerprint");
|
||||
return -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
contact = get_options()->ContactInfo;
|
||||
@ -1084,11 +1084,15 @@ generate_v2_networkstatus(void)
|
||||
format_iso_time(published, ri->published_on);
|
||||
|
||||
if (base64_encode(identity64, sizeof(identity64),
|
||||
ri->identity_digest, DIGEST_LEN)<0)
|
||||
ri->identity_digest, DIGEST_LEN)<0) {
|
||||
log_fn(LOG_WARN, "Unable to encode router identity digest.");
|
||||
goto done;
|
||||
}
|
||||
if (base64_encode(digest64, sizeof(digest64),
|
||||
ri->signed_descriptor_digest, DIGEST_LEN)<0)
|
||||
ri->signed_descriptor_digest, DIGEST_LEN)<0) {
|
||||
log_fn(LOG_WARN, "Unable to encode router descriptor digest.");
|
||||
goto done;
|
||||
}
|
||||
identity64[BASE64_DIGEST_LEN] = '\0';
|
||||
digest64[BASE64_DIGEST_LEN] = '\0';
|
||||
|
||||
@ -1128,8 +1132,10 @@ generate_v2_networkstatus(void)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0)
|
||||
if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0) {
|
||||
log_fn(LOG_WARN, "Unable to sign router status.");
|
||||
goto done;
|
||||
}
|
||||
|
||||
set_cached_dir(&the_v2_networkstatus, status, time(NULL));
|
||||
status = NULL; /* So it doesn't get double-freed. */
|
||||
@ -1172,6 +1178,7 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
|
||||
the_v2_networkstatus_is_dirty,
|
||||
generate_v2_networkstatus,
|
||||
"network status list", 0);
|
||||
log_fn(LOG_WARN, "Unable to generate an authoritative network stautus.");
|
||||
if (d)
|
||||
smartlist_add(result, d);
|
||||
}
|
||||
@ -1184,6 +1191,8 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
|
||||
smartlist_add(result, val);
|
||||
iter = strmap_iter_next(cached_v2_networkstatus, iter);
|
||||
}
|
||||
if (smartlist_len(result) == 0)
|
||||
log_fn(LOG_WARN, "Client requested 'all' network status objects; we have none.");
|
||||
} else if (!strcmpstart(key, "fp/")) {
|
||||
smartlist_t *hexdigests = smartlist_create();
|
||||
smartlist_split_string(hexdigests, key+3, "+", 0, 0);
|
||||
@ -1197,9 +1206,14 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
|
||||
the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL))
|
||||
generate_v2_networkstatus();
|
||||
cached = strmap_get(cached_v2_networkstatus, cp);
|
||||
if (cached)
|
||||
if (cached) {
|
||||
smartlist_add(result, cached);
|
||||
} else {
|
||||
log_fn(LOG_WARN, "Don't know about any network status with fingerprint '%s'", cp);
|
||||
}
|
||||
tor_free(cp);
|
||||
});
|
||||
smartlist_free(hexdigests);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user