mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Move the "is the network disabled?" functions out of router.c
Since this is completely core functionality, I'm putting it in core/mainloop, even though it depends on feature/hibernate. We'll have to sort that out in the future.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/* Copyright (c) 2001 Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2018, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#include "core/or/or.h"
|
||||
#include "core/mainloop/netstatus.h"
|
||||
#include "app/config/config.h"
|
||||
#include "feature/hibernate/hibernate.h"
|
||||
|
||||
/** Return true iff our network is in some sense disabled or shutting down:
|
||||
* either we're hibernating, entering hibernation, or the network is turned
|
||||
* off with DisableNetwork. */
|
||||
int
|
||||
net_is_disabled(void)
|
||||
{
|
||||
return get_options()->DisableNetwork || we_are_hibernating();
|
||||
}
|
||||
|
||||
/** Return true iff our network is in some sense "completely disabled" either
|
||||
* we're fully hibernating or the network is turned off with
|
||||
* DisableNetwork. */
|
||||
int
|
||||
net_is_completely_disabled(void)
|
||||
{
|
||||
return get_options()->DisableNetwork || we_are_fully_hibernating();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2001 Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2018, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#ifndef TOR_NETSTATUS_H
|
||||
#define TOR_NETSTATUS_H
|
||||
|
||||
int net_is_disabled(void);
|
||||
int net_is_completely_disabled(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user