Tor
0.4.7.0-alpha-dev
|
Track whether the network is disabled, dormant, etc. More...
#include "core/or/or.h"
#include "core/mainloop/netstatus.h"
#include "core/mainloop/mainloop.h"
#include "core/mainloop/mainloop_state_st.h"
#include "app/config/config.h"
#include "feature/hibernate/hibernate.h"
#include "app/config/or_state_st.h"
Go to the source code of this file.
Functions | |
int | net_is_disabled (void) |
int | net_is_completely_disabled (void) |
void | note_user_activity (time_t now) |
void | reset_user_activity (time_t now) |
time_t | get_last_user_activity_time (void) |
void | set_network_participation (bool participation) |
bool | is_participating_on_network (void) |
void | netstatus_flush_to_state (mainloop_state_t *state, time_t now) |
void | netstatus_load_from_state (const mainloop_state_t *state, time_t now) |
void | netstatus_note_clock_jumped (time_t seconds_diff) |
Variables | |
static time_t | last_user_activity_seen = 0 |
static bool | participating_on_network = false |
Track whether the network is disabled, dormant, etc.
Definition in file netstatus.c.
time_t get_last_user_activity_time | ( | void | ) |
Return the most recent time at which we recorded "user activity".
Definition at line 91 of file netstatus.c.
Referenced by check_network_participation_callback(), and netstatus_note_clock_jumped().
bool is_participating_on_network | ( | void | ) |
Return true iff we are currently participating on the network.
Definition at line 110 of file netstatus.c.
int net_is_completely_disabled | ( | void | ) |
Return true iff our network is in some sense "completely disabled" either we're fully hibernating or the network is turned off with DisableNetwork.
Definition at line 34 of file netstatus.c.
Referenced by connection_connect_sockaddr().
int net_is_disabled | ( | void | ) |
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.
Definition at line 25 of file netstatus.c.
Referenced by check_descriptor_callback(), check_dns_honesty_callback(), check_for_reachability_bw_callback(), decide_to_advertise_dir_impl(), directory_info_has_arrived(), launch_reachability_tests_callback(), launch_resolve(), launch_test_addresses(), prune_old_routers_callback(), reachability_warnings_callback(), rescan_periodic_events(), retry_listeners_callback(), router_reachability_checks_disabled(), and second_elapsed_callback().
void netstatus_flush_to_state | ( | mainloop_state_t * | state, |
time_t | now | ||
) |
Update 'state' with the last time at which we were active on the network.
Definition at line 119 of file netstatus.c.
void netstatus_load_from_state | ( | const mainloop_state_t * | state, |
time_t | now | ||
) |
Update our current view of network participation from an or_state_t object.
Definition at line 134 of file netstatus.c.
void netstatus_note_clock_jumped | ( | time_t | seconds_diff | ) |
Adjust the time at which the user was last active by seconds_diff in response to a clock jump.
Definition at line 168 of file netstatus.c.
void note_user_activity | ( | time_t | now | ) |
Record the fact that we have seen "user activity" at the time now. Move "last activity seen" time forwards, but never backwards.
If we were previously not participating on the network, set our participation status to true, and launch periodic events as appropriate.
Definition at line 63 of file netstatus.c.
Referenced by connection_edge_flushed_some(), connection_edge_process_inbuf(), and dnsserv_launch_request().
void reset_user_activity | ( | time_t | now | ) |
Change the time at which "user activity" was last seen to now.
Unlike note_user_actity, this function sets the time without checking whether it is in the past, and without causing any rescan of periodic events or change in participation status.
Definition at line 82 of file netstatus.c.
Referenced by netstatus_load_from_state(), and netstatus_note_clock_jumped().
void set_network_participation | ( | bool | participation | ) |
Set the field that remembers whether we are currently participating on the network. Does not schedule or un-schedule periodic events.
Definition at line 101 of file netstatus.c.
|
static |
The time at which we've last seen "user activity" – that is, any activity that should keep us as a participant on the network.
This is not actually the true time. We will adjust this forward if our clock jumps, or if Tor is shut down for a while, so that the time since our last activity remains as it was before the jump or shutdown.
Definition at line 47 of file netstatus.c.
Referenced by get_last_user_activity_time(), netstatus_flush_to_state(), note_user_activity(), and reset_user_activity().
|
static |
True iff we are currently a "network participant" – that is, we are building circuits, fetching directory information, and so on.
Definition at line 53 of file netstatus.c.
Referenced by is_participating_on_network(), netstatus_flush_to_state(), netstatus_load_from_state(), note_user_activity(), and set_network_participation().