mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
Do not try to double-aquire lock when rotating keys. May fix deadlock bug found by weasel.
svn:r3616
This commit is contained in:
parent
5d836c8140
commit
58540dde50
@ -129,13 +129,15 @@ void rotate_onion_key(void)
|
|||||||
log(LOG_ERR, "Couldn't write generated key to %s.", fname);
|
log(LOG_ERR, "Couldn't write generated key to %s.", fname);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
log_fn(LOG_INFO, "Rotating onion key");
|
||||||
tor_mutex_acquire(key_lock);
|
tor_mutex_acquire(key_lock);
|
||||||
if (lastonionkey)
|
if (lastonionkey)
|
||||||
crypto_free_pk_env(lastonionkey);
|
crypto_free_pk_env(lastonionkey);
|
||||||
log_fn(LOG_INFO, "Rotating onion key");
|
|
||||||
lastonionkey = onionkey;
|
lastonionkey = onionkey;
|
||||||
set_onion_key(prkey);
|
onionkey = prkey;
|
||||||
|
onionkey_set_at = time(NULL);
|
||||||
tor_mutex_release(key_lock);
|
tor_mutex_release(key_lock);
|
||||||
|
mark_my_descriptor_dirty();
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
log_fn(LOG_WARN, "Couldn't rotate onion key.");
|
log_fn(LOG_WARN, "Couldn't rotate onion key.");
|
||||||
|
Loading…
Reference in New Issue
Block a user