|
@@ -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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ * 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();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
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)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-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();
|
|
|
|
|
|
|
|
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);
|