mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Create a relay subsystem and move the shutdown functions there
This commit is contained in:
parent
2aa441b88e
commit
b394b5b2af
@ -47,17 +47,13 @@
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
#include "feature/nodelist/routerlist.h"
|
||||
#include "feature/nodelist/routerlist.h"
|
||||
#include "feature/relay/dns.h"
|
||||
#include "feature/relay/ext_orport.h"
|
||||
#include "feature/relay/onion_queue.h"
|
||||
#include "feature/relay/routerkeys.h"
|
||||
#include "feature/rend/rendcache.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/stats/geoip_stats.h"
|
||||
#include "feature/stats/rephist.h"
|
||||
#include "lib/evloop/compat_libevent.h"
|
||||
#include "lib/geoip/geoip.h"
|
||||
#include "src/feature/relay/router.h"
|
||||
|
||||
void evdns_shutdown(int);
|
||||
|
||||
@ -127,8 +123,6 @@ tor_free_all(int postfork)
|
||||
rend_cache_free_all();
|
||||
rend_service_authorization_free_all();
|
||||
rep_hist_free_all();
|
||||
dns_free_all();
|
||||
clear_pending_onions();
|
||||
circuit_free_all();
|
||||
circpad_machines_free();
|
||||
entry_guards_free_all();
|
||||
@ -141,7 +135,6 @@ tor_free_all(int postfork)
|
||||
nodelist_free_all();
|
||||
microdesc_free_all();
|
||||
routerparse_free_all();
|
||||
ext_orport_free_all();
|
||||
control_free_all();
|
||||
protover_free_all();
|
||||
bridges_free_all();
|
||||
@ -155,8 +148,6 @@ tor_free_all(int postfork)
|
||||
if (!postfork) {
|
||||
config_free_all();
|
||||
or_state_free_all();
|
||||
router_free_all();
|
||||
routerkeys_free_all();
|
||||
policies_free_all();
|
||||
}
|
||||
if (!postfork) {
|
||||
|
@ -137,6 +137,7 @@ LIBTOR_APP_A_SOURCES = \
|
||||
src/feature/relay/dns.c \
|
||||
src/feature/relay/ext_orport.c \
|
||||
src/feature/relay/onion_queue.c \
|
||||
src/feature/relay/relay_sys.c \
|
||||
src/feature/relay/router.c \
|
||||
src/feature/relay/routerkeys.c \
|
||||
src/feature/relay/routermode.c \
|
||||
@ -405,6 +406,7 @@ noinst_HEADERS += \
|
||||
src/feature/relay/dns_structs.h \
|
||||
src/feature/relay/ext_orport.h \
|
||||
src/feature/relay/onion_queue.h \
|
||||
src/feature/relay/relay_sys.h \
|
||||
src/feature/relay/router.h \
|
||||
src/feature/relay/routerkeys.h \
|
||||
src/feature/relay/routermode.h \
|
||||
|
46
src/feature/relay/relay_sys.c
Normal file
46
src/feature/relay/relay_sys.c
Normal file
@ -0,0 +1,46 @@
|
||||
/* Copyright (c) 2001 Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2019, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
/**
|
||||
* @file relay_sys.c
|
||||
* @brief Subsystem definitions for the relay module.
|
||||
**/
|
||||
|
||||
#include "orconfig.h"
|
||||
#include "core/or/or.h"
|
||||
|
||||
#include "feature/relay/dns.h"
|
||||
#include "feature/relay/ext_orport.h"
|
||||
#include "feature/relay/onion_queue.h"
|
||||
#include "feature/relay/relay_sys.h"
|
||||
#include "feature/relay/routerkeys.h"
|
||||
#include "feature/relay/router.h"
|
||||
|
||||
#include "lib/subsys/subsys.h"
|
||||
|
||||
static int
|
||||
subsys_relay_initialize(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
subsys_relay_shutdown(void)
|
||||
{
|
||||
dns_free_all();
|
||||
ext_orport_free_all();
|
||||
clear_pending_onions();
|
||||
routerkeys_free_all();
|
||||
router_free_all();
|
||||
}
|
||||
|
||||
const struct subsys_fns_t sys_relay = {
|
||||
.name = "relay",
|
||||
.supported = true,
|
||||
.level = 50,
|
||||
.initialize = subsys_relay_initialize,
|
||||
.shutdown = subsys_relay_shutdown,
|
||||
};
|
17
src/feature/relay/relay_sys.h
Normal file
17
src/feature/relay/relay_sys.h
Normal file
@ -0,0 +1,17 @@
|
||||
/* Copyright (c) 2001 Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2019, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
/**
|
||||
* @file relay_sys.h
|
||||
* @brief Header for feature/relay/relay_sys.c
|
||||
**/
|
||||
|
||||
#ifndef TOR_FEATURE_RELAY_RELAY_SYS_H
|
||||
#define TOR_FEATURE_RELAY_RELAY_SYS_H
|
||||
|
||||
extern const struct subsys_fns_t sys_relay;
|
||||
|
||||
#endif /* !defined(TOR_FEATURE_RELAY_RELAY_SYS_H) */
|
Loading…
Reference in New Issue
Block a user