netstatus.c 927 B

12345678910111213141516171819202122232425262728
  1. /* Copyright (c) 2001 Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2019, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #include "core/or/or.h"
  7. #include "core/mainloop/netstatus.h"
  8. #include "app/config/config.h"
  9. #include "feature/hibernate/hibernate.h"
  10. /** Return true iff our network is in some sense disabled or shutting down:
  11. * either we're hibernating, entering hibernation, or the network is turned
  12. * off with DisableNetwork. */
  13. int
  14. net_is_disabled(void)
  15. {
  16. return get_options()->DisableNetwork || we_are_hibernating();
  17. }
  18. /** Return true iff our network is in some sense "completely disabled" either
  19. * we're fully hibernating or the network is turned off with
  20. * DisableNetwork. */
  21. int
  22. net_is_completely_disabled(void)
  23. {
  24. return get_options()->DisableNetwork || we_are_fully_hibernating();
  25. }