mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
Merge branch 'restart_nocrash'
This commit is contained in:
commit
05ac3d0458
7 changed files with 27 additions and 3 deletions
7
changes/bug24581
Normal file
7
changes/bug24581
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
o Major features (embedding):
|
||||||
|
- Tor now has support for restarting in the same process.
|
||||||
|
Controllers that run Tor using the "tor_api.h" interface can now
|
||||||
|
restart Tor after Tor has exited. This support is incomplete, however:
|
||||||
|
we have fixed the crash bugs that prevented it from working at all
|
||||||
|
before, but many bugs probably remain. Implements ticket 24581.
|
||||||
|
|
|
@ -237,6 +237,16 @@ tor_init_libevent_rng(void)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Un-initialize libevent in preparation for an exit
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
tor_libevent_free_all(void)
|
||||||
|
{
|
||||||
|
event_base_free(the_event_base);
|
||||||
|
the_event_base = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(LIBEVENT_VERSION_NUMBER) && \
|
#if defined(LIBEVENT_VERSION_NUMBER) && \
|
||||||
LIBEVENT_VERSION_NUMBER >= V(2,1,1) && \
|
LIBEVENT_VERSION_NUMBER >= V(2,1,1) && \
|
||||||
!defined(TOR_UNIT_TESTS)
|
!defined(TOR_UNIT_TESTS)
|
||||||
|
|
|
@ -52,6 +52,7 @@ const char *tor_libevent_get_method(void);
|
||||||
void tor_check_libevent_header_compatibility(void);
|
void tor_check_libevent_header_compatibility(void);
|
||||||
const char *tor_libevent_get_version_str(void);
|
const char *tor_libevent_get_version_str(void);
|
||||||
const char *tor_libevent_get_header_version_str(void);
|
const char *tor_libevent_get_header_version_str(void);
|
||||||
|
void tor_libevent_free_all(void);
|
||||||
|
|
||||||
int tor_init_libevent_rng(void);
|
int tor_init_libevent_rng(void);
|
||||||
|
|
||||||
|
|
|
@ -3470,6 +3470,8 @@ crypto_global_cleanup(void)
|
||||||
if (dh_param_g)
|
if (dh_param_g)
|
||||||
BN_clear_free(dh_param_g);
|
BN_clear_free(dh_param_g);
|
||||||
|
|
||||||
|
dh_param_p = dh_param_p_tls = dh_param_g = NULL;
|
||||||
|
|
||||||
#ifndef DISABLE_ENGINES
|
#ifndef DISABLE_ENGINES
|
||||||
ENGINE_cleanup();
|
ENGINE_cleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -805,6 +805,8 @@ static smartlist_t *configured_ports = NULL;
|
||||||
/** True iff we're currently validating options, and any calls to
|
/** True iff we're currently validating options, and any calls to
|
||||||
* get_options() are likely to be bugs. */
|
* get_options() are likely to be bugs. */
|
||||||
static int in_option_validation = 0;
|
static int in_option_validation = 0;
|
||||||
|
/* True iff we've initialized libevent */
|
||||||
|
static int libevent_initialized = 0;
|
||||||
|
|
||||||
/** Return the contents of our frontpage string, or NULL if not configured. */
|
/** Return the contents of our frontpage string, or NULL if not configured. */
|
||||||
MOCK_IMPL(const char*,
|
MOCK_IMPL(const char*,
|
||||||
|
@ -995,6 +997,7 @@ config_free_all(void)
|
||||||
tor_free(the_tor_version);
|
tor_free(the_tor_version);
|
||||||
|
|
||||||
have_parsed_cmdline = 0;
|
have_parsed_cmdline = 0;
|
||||||
|
libevent_initialized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Make <b>address</b> -- a piece of information related to our operation as
|
/** Make <b>address</b> -- a piece of information related to our operation as
|
||||||
|
@ -1345,7 +1348,6 @@ options_act_reversible(const or_options_t *old_options, char **msg)
|
||||||
{
|
{
|
||||||
smartlist_t *new_listeners = smartlist_new();
|
smartlist_t *new_listeners = smartlist_new();
|
||||||
smartlist_t *replaced_listeners = smartlist_new();
|
smartlist_t *replaced_listeners = smartlist_new();
|
||||||
static int libevent_initialized = 0;
|
|
||||||
or_options_t *options = get_options_mutable();
|
or_options_t *options = get_options_mutable();
|
||||||
int running_tor = options->command == CMD_RUN_TOR;
|
int running_tor = options->command == CMD_RUN_TOR;
|
||||||
int set_conn_limit = 0;
|
int set_conn_limit = 0;
|
||||||
|
|
|
@ -3478,6 +3478,7 @@ tor_free_all(int postfork)
|
||||||
if (!postfork) {
|
if (!postfork) {
|
||||||
release_lockfile();
|
release_lockfile();
|
||||||
}
|
}
|
||||||
|
tor_libevent_free_all();
|
||||||
/* Stuff in util.c and address.c*/
|
/* Stuff in util.c and address.c*/
|
||||||
if (!postfork) {
|
if (!postfork) {
|
||||||
escaped(NULL);
|
escaped(NULL);
|
||||||
|
|
|
@ -71,8 +71,9 @@ void tor_main_configuration_free(tor_main_configuration_t *cfg);
|
||||||
* fix it.
|
* fix it.
|
||||||
*
|
*
|
||||||
* BUG 23847: You can only call tor_main() once in a single process; if it
|
* BUG 23847: You can only call tor_main() once in a single process; if it
|
||||||
* returns and you call it again, you may crash. This is not intended
|
* returns and you call it again, you may crash, or you may encounter other
|
||||||
* long-term behavior; we are trying to fix it.
|
* unexpected behavior. This is not intended long-term behavior; we are
|
||||||
|
* trying to fix it.
|
||||||
*
|
*
|
||||||
* LIMITATION: You cannot run more than one instance of Tor in the same
|
* LIMITATION: You cannot run more than one instance of Tor in the same
|
||||||
* process at the same time. Concurrent calls will cause undefined behavior.
|
* process at the same time. Concurrent calls will cause undefined behavior.
|
||||||
|
|
Loading…
Add table
Reference in a new issue