mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
fix some more places where we shouldn't crash if we can't build
our own descriptor yet. svn:r6775
This commit is contained in:
parent
9db7b2c068
commit
42e2057d67
@ -181,7 +181,8 @@ circuit_rep_hist_note_result(circuit_t *circ)
|
||||
}
|
||||
if (server_mode(get_options())) {
|
||||
routerinfo_t *me = router_get_my_routerinfo();
|
||||
tor_assert(me);
|
||||
if (!me)
|
||||
return;
|
||||
prev_digest = me->cache_info.identity_digest;
|
||||
}
|
||||
do {
|
||||
|
@ -731,7 +731,7 @@ run_scheduled_events(time_t now)
|
||||
rotate_onion_key();
|
||||
cpuworkers_rotate();
|
||||
if (router_rebuild_descriptor(1)<0) {
|
||||
log_warn(LD_BUG, "Couldn't rebuild router descriptor");
|
||||
log_info(LD_CONFIG, "Couldn't rebuild router descriptor");
|
||||
}
|
||||
if (advertised_server_mode())
|
||||
router_upload_dir_desc_to_dirservers(0);
|
||||
|
@ -232,7 +232,8 @@ init_key_from_file(const char *fname)
|
||||
}
|
||||
|
||||
/** Initialize all OR private keys, and the TLS context, as necessary.
|
||||
* On OPs, this only initializes the tls context.
|
||||
* On OPs, this only initializes the tls context. Return 0 on success,
|
||||
* or -1 if Tor should die.
|
||||
*/
|
||||
int
|
||||
init_keys(void)
|
||||
@ -310,10 +311,6 @@ init_keys(void)
|
||||
/* 4. Build our router descriptor. */
|
||||
/* Must be called after keys are initialized. */
|
||||
mydesc = router_get_my_descriptor();
|
||||
if (!mydesc) {
|
||||
log_err(LD_GENERAL,"Error initializing descriptor.");
|
||||
return -1;
|
||||
}
|
||||
if (authdir_mode(options)) {
|
||||
const char *m;
|
||||
/* We need to add our own fingerprint so it gets recognized. */
|
||||
@ -321,6 +318,10 @@ init_keys(void)
|
||||
log_err(LD_GENERAL,"Error adding own fingerprint to approved set");
|
||||
return -1;
|
||||
}
|
||||
if (!mydesc) {
|
||||
log_err(LD_GENERAL,"Error initializing descriptor.");
|
||||
return -1;
|
||||
}
|
||||
if (dirserv_add_descriptor(mydesc, &m) < 0) {
|
||||
log_err(LD_GENERAL,"Unable to add own descriptor to directory: %s",
|
||||
m?m:"<unknown error>");
|
||||
@ -328,13 +329,6 @@ init_keys(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
tor_snprintf(keydir,sizeof(keydir),"%s/router.desc", datadir);
|
||||
log_info(LD_GENERAL,"Dumping descriptor to \"%s\"...",keydir);
|
||||
if (write_str_to_file(keydir, mydesc,0)) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
/* 5. Dump fingerprint to 'fingerprint' */
|
||||
tor_snprintf(keydir,sizeof(keydir),"%s/fingerprint", datadir);
|
||||
log_info(LD_GENERAL,"Dumping fingerprint to \"%s\"...",keydir);
|
||||
@ -447,11 +441,8 @@ void
|
||||
consider_testing_reachability(void)
|
||||
{
|
||||
routerinfo_t *me = router_get_my_routerinfo();
|
||||
if (!me) {
|
||||
log_warn(LD_BUG,
|
||||
"Bug: router_get_my_routerinfo() did not find my routerinfo?");
|
||||
if (!me)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_whether_orport_reachable()) {
|
||||
log_info(LD_CIRC, "Testing reachability of my ORPort: %s:%d.",
|
||||
@ -644,7 +635,7 @@ router_upload_dir_desc_to_dirservers(int force)
|
||||
|
||||
s = router_get_my_descriptor();
|
||||
if (!s) {
|
||||
log_warn(LD_GENERAL, "No descriptor; skipping upload");
|
||||
log_info(LD_GENERAL, "No descriptor; skipping upload");
|
||||
return;
|
||||
}
|
||||
if (!get_options()->PublishServerDescriptor)
|
||||
|
Loading…
Reference in New Issue
Block a user