mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
612b0a4139
Fix levels for subsystems that depend on log/err * winprocess (security) doesn't use err: * call windows process security APIs as early as possible * init err after winprocess * move wallclock so it's still after err * network and time depend on log: * make sure that network and time can use logging. * init network and time after log Add comments explaining the module init order. Fixes bug 31615; bugfix on 0.4.0.1-alpha.
47 lines
870 B
C
47 lines
870 B
C
/* Copyright (c) 2018-2019, The Tor Project, Inc. */
|
|
/* See LICENSE for licensing information */
|
|
|
|
/**
|
|
* \file network_sys.c
|
|
* \brief Subsystem object for networking setup.
|
|
**/
|
|
|
|
#include "orconfig.h"
|
|
#include "lib/subsys/subsys.h"
|
|
#include "lib/net/network_sys.h"
|
|
#include "lib/net/resolve.h"
|
|
#include "lib/net/socket.h"
|
|
|
|
#ifdef _WIN32
|
|
#include <winsock2.h>
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
static int
|
|
subsys_network_initialize(void)
|
|
{
|
|
if (network_init() < 0)
|
|
return -1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void
|
|
subsys_network_shutdown(void)
|
|
{
|
|
#ifdef _WIN32
|
|
WSACleanup();
|
|
#endif
|
|
tor_free_getaddrinfo_cache();
|
|
}
|
|
|
|
const subsys_fns_t sys_network = {
|
|
.name = "network",
|
|
/* Network depends on logging, and a lot of other modules depend on network.
|
|
*/
|
|
.level = -80,
|
|
.supported = true,
|
|
.initialize = subsys_network_initialize,
|
|
.shutdown = subsys_network_shutdown,
|
|
};
|