mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Expose/mock some functions to make ext_orport.c testing possible
This commit is contained in:
parent
fd6749203e
commit
d7358e8598
@ -4699,8 +4699,8 @@ control_event_bootstrap(bootstrap_status_t status, int progress)
|
|||||||
* that indicates a problem. <b>warn</b> gives a hint as to why, and
|
* that indicates a problem. <b>warn</b> gives a hint as to why, and
|
||||||
* <b>reason</b> provides an "or_conn_end_reason" tag.
|
* <b>reason</b> provides an "or_conn_end_reason" tag.
|
||||||
*/
|
*/
|
||||||
void
|
MOCK_IMPL(void,
|
||||||
control_event_bootstrap_problem(const char *warn, int reason)
|
control_event_bootstrap_problem, (const char *warn, int reason))
|
||||||
{
|
{
|
||||||
int status = bootstrap_percent;
|
int status = bootstrap_percent;
|
||||||
const char *tag, *summary;
|
const char *tag, *summary;
|
||||||
|
@ -85,7 +85,8 @@ void enable_control_logging(void);
|
|||||||
void monitor_owning_controller_process(const char *process_spec);
|
void monitor_owning_controller_process(const char *process_spec);
|
||||||
|
|
||||||
void control_event_bootstrap(bootstrap_status_t status, int progress);
|
void control_event_bootstrap(bootstrap_status_t status, int progress);
|
||||||
void control_event_bootstrap_problem(const char *warn, int reason);
|
MOCK_DECL(void, control_event_bootstrap_problem,(const char *warn,
|
||||||
|
int reason));
|
||||||
|
|
||||||
void control_event_clients_seen(const char *controller_str);
|
void control_event_clients_seen(const char *controller_str);
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
* connections, implements main loop, and drives scheduled events.
|
* connections, implements main loop, and drives scheduled events.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#define MAIN_PRIVATE
|
||||||
#include "or.h"
|
#include "or.h"
|
||||||
#include "addressmap.h"
|
#include "addressmap.h"
|
||||||
#include "buffers.h"
|
#include "buffers.h"
|
||||||
@ -412,6 +413,19 @@ connection_unlink(connection_t *conn)
|
|||||||
connection_free(conn);
|
connection_free(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Initialize the global connection list, closeable connection list,
|
||||||
|
* and active connection list. */
|
||||||
|
STATIC void
|
||||||
|
init_connection_lists(void)
|
||||||
|
{
|
||||||
|
if (!connection_array)
|
||||||
|
connection_array = smartlist_new();
|
||||||
|
if (!closeable_connection_lst)
|
||||||
|
closeable_connection_lst = smartlist_new();
|
||||||
|
if (!active_linked_connection_lst)
|
||||||
|
active_linked_connection_lst = smartlist_new();
|
||||||
|
}
|
||||||
|
|
||||||
/** Schedule <b>conn</b> to be closed. **/
|
/** Schedule <b>conn</b> to be closed. **/
|
||||||
void
|
void
|
||||||
add_connection_to_closeable_list(connection_t *conn)
|
add_connection_to_closeable_list(connection_t *conn)
|
||||||
@ -685,7 +699,7 @@ connection_stop_reading_from_linked_conn(connection_t *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Close all connections that have been scheduled to get closed. */
|
/** Close all connections that have been scheduled to get closed. */
|
||||||
static void
|
STATIC void
|
||||||
close_closeable_connections(void)
|
close_closeable_connections(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -2307,12 +2321,7 @@ tor_init(int argc, char *argv[])
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
int i, quiet = 0;
|
int i, quiet = 0;
|
||||||
time_of_process_start = time(NULL);
|
time_of_process_start = time(NULL);
|
||||||
if (!connection_array)
|
init_connection_lists();
|
||||||
connection_array = smartlist_new();
|
|
||||||
if (!closeable_connection_lst)
|
|
||||||
closeable_connection_lst = smartlist_new();
|
|
||||||
if (!active_linked_connection_lst)
|
|
||||||
active_linked_connection_lst = smartlist_new();
|
|
||||||
/* Have the log set up with our application name. */
|
/* Have the log set up with our application name. */
|
||||||
tor_snprintf(buf, sizeof(buf), "Tor %s", get_version());
|
tor_snprintf(buf, sizeof(buf), "Tor %s", get_version());
|
||||||
log_set_application_name(buf);
|
log_set_application_name(buf);
|
||||||
|
@ -69,5 +69,10 @@ int tor_main(int argc, char *argv[]);
|
|||||||
int do_main_loop(void);
|
int do_main_loop(void);
|
||||||
int tor_init(int argc, char **argv);
|
int tor_init(int argc, char **argv);
|
||||||
|
|
||||||
|
#ifdef MAIN_PRIVATE
|
||||||
|
STATIC void init_connection_lists(void);
|
||||||
|
STATIC void close_closeable_connections(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user