LCOV - code coverage report
Current view: top level - lib/net - network_sys.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 5 6 83.3 %
Date: 2021-11-24 03:28:48 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* Copyright (c) 2018-2021, The Tor Project, Inc. */
       2             : /* See LICENSE for licensing information */
       3             : 
       4             : /**
       5             :  * \file network_sys.c
       6             :  * \brief Subsystem object for networking setup.
       7             :  **/
       8             : 
       9             : #include "orconfig.h"
      10             : #include "lib/subsys/subsys.h"
      11             : #include "lib/net/network_sys.h"
      12             : #include "lib/net/resolve.h"
      13             : #include "lib/net/socket.h"
      14             : 
      15             : #ifdef _WIN32
      16             : #include <winsock2.h>
      17             : #include <windows.h>
      18             : #endif
      19             : 
      20             : static int
      21        5553 : subsys_network_initialize(void)
      22             : {
      23        5553 :   if (network_init() < 0)
      24           0 :     return -1;
      25             : 
      26             :   return 0;
      27             : }
      28             : 
      29             : static void
      30         235 : subsys_network_shutdown(void)
      31             : {
      32             : #ifdef _WIN32
      33             :   WSACleanup();
      34             : #endif
      35         235 :   tor_free_getaddrinfo_cache();
      36         235 : }
      37             : 
      38             : const subsys_fns_t sys_network = {
      39             :   .name = "network",
      40             :   SUBSYS_DECLARE_LOCATION(),
      41             :   /* Network depends on logging, and a lot of other modules depend on network.
      42             :    */
      43             :   .level = -55,
      44             :   .supported = true,
      45             :   .initialize = subsys_network_initialize,
      46             :   .shutdown = subsys_network_shutdown,
      47             : };

Generated by: LCOV version 1.14