Commit Graph

58 Commits

Author SHA1 Message Date
Neel Chauhan c07d854772 Remove callback for setting bridges as running 2019-04-11 21:28:35 -04:00
Neel Chauhan 4172dcaa62 Move code for setting bridges as running to voteflags.c 2019-04-11 20:44:30 -04:00
Neel Chauhan 30279a7c57 Use authdir_mode_bridge() in set_bridge_running_callback() 2019-04-11 20:28:11 -04:00
Neel Chauhan aa9940ed21 Make SET_BRIDGES_RUNNING_INTERVAL 5 minutes 2019-04-11 20:24:08 -04:00
Neel Chauhan d4d77b277e Stop setting bridges running in networkstatus_getinfo_by_purpose() 2019-04-03 15:27:33 -04:00
Nick Mathewson a49f506e05 Split all controller events code into a new control_events.c
Also, split the formatting code shared by control.c and
control_events.c into controller_fmt.c.
2019-03-25 12:11:59 -04:00
Nick Mathewson 2f683465d4 Bump copyright date to 2019 2019-01-16 12:33:22 -05:00
Nick Mathewson 3df1d29d9b Merge branch 'bug28591_035_squashed' 2019-01-09 09:33:31 -05:00
Nick Mathewson 99713b176b Merge branch 'maint-0.3.5' 2018-12-21 15:42:58 -05:00
Nick Mathewson a9eec33649 Merge branch 'maint-0.3.4' into maint-0.3.5 2018-12-21 15:42:57 -05:00
Nick Mathewson e969d9c6b4 Merge branch 'ticket28179_squashed' into ticket28179_squashed_merged 2018-12-17 16:41:01 -05:00
Alexander Færøy bc6983afed Use run_main_loop_until_done() for process_t tests.
This patch changes the slow process_t tests to use
run_main_loop_until_done() instead of do_main_loop() since
do_main_loop() initializes a lot of subsystem callbacks that we don't
need to run in our tests.

See: https://bugs.torproject.org/28179
2018-12-17 16:39:28 -05:00
Alexander Færøy bfb94dd2ca Use process_t for managed proxies.
This patch makes the managed proxy subsystem use the process_t data
structure such that we can get events from the PT process while Tor is
running and not just when the PT process is being configured.

See: https://bugs.torproject.org/28179
2018-12-17 16:39:28 -05:00
Nick Mathewson 69264f96f3 Merge branch 'dormant_persist_squashed' 2018-12-13 08:26:10 -05:00
Nick Mathewson b5c04173c8 Change interaction between dormant mode and clock jumps.
When the clock jumps, and we have a record of last user activity,
adjust that record.  This way if I'm inactive for 10 minutes and
then the laptop is sleeping for an hour, I'll still count as having
been inactive for 10 minutes.

Previously, we treat every jump as if it were activity, which is
ridiculous, and would prevent a Tor instance with a jumpy clock from
ever going dormant.
2018-12-13 08:25:54 -05:00
Nick Mathewson ca4b86f90a Merge remote-tracking branch 'tor-github/pr/508' 2018-12-05 08:19:02 -05:00
Nick Mathewson b25b8150c2 Remember in our state file how long we've spent since user activity
Rather than initializing the "Dormant" status to "off" and the "last
activity" count to "now", initialize them based on our state file:
stay dormant if we were dormant, or remember the amount of time
we've spent inactive.
2018-12-04 11:59:11 -05:00
teor bd29b3531a Dir: Refactor ns expiry check to remove duplicate code
Instead of checking NS_EXPIRY_SLOP, use
networkstatus_consensus_reasonably_live().

Preparation for 28591.
2018-11-29 00:50:16 +10:00
Nick Mathewson fc1ad9ab65 Merge remote-tracking branch 'tor-github/pr/495' 2018-11-26 17:17:40 -05:00
Nick Mathewson 02843c4a4e Test for check_network_participation_callback() 2018-11-26 16:32:40 -05:00
Nick Mathewson 55512ef022 Test netstatus.c tracking of user participation status 2018-11-26 16:32:40 -05:00
Nick Mathewson 3743f79695 Add options to control dormant-client feature.
The DormantClientTimeout option controls how long Tor will wait before
going dormant.  It also provides a way to disable the feature by setting
DormantClientTimeout to e.g. "50 years".

The DormantTimeoutDisabledByIdleStreams option controls whether open but
inactive streams count as "client activity".  To implement it, I had to
make it so that reading or writing on a client stream *always* counts as
activity.

Closes ticket 28429.
2018-11-26 16:32:40 -05:00
rl1987 411780d563 Make ROUTERLIST_PRUNING_INTERVAL 1 hr. 2018-11-17 10:19:25 +02:00
Nick Mathewson 53ccdb6945 Make sure that we are always a net participant when being a server
Otherwise, if we're dormant, and we set ORPort, nothing makes us become
non-dormant.
2018-11-15 11:17:27 -05:00
Nick Mathewson 2f28cd1dc8 Rename and fix docs on FLUSH_ON_DISABLE
Also rename "...flush_and_disable()" to "...schedule_and_disable()"
2018-11-15 11:17:22 -05:00
Nick Mathewson d0e6abd087 Reset dormancy status when the clock jumps. 2018-11-15 11:17:22 -05:00
Nick Mathewson ce6209cee4 Add a periodic event to become dormant.
This event makes us become dormant if we have seen no activity in a
long time.

Note that being any kind of a server, or running an onion service,
always counts as being active.

Note that right now, just having an open stream that Tor
did not open on its own (for a directory request) counts as "being
active", so if you have an idle ssh connection, that will keep Tor
from becoming dormant.

Many of the features here should become configurable; I'd like
feedback on which.
2018-11-15 11:17:22 -05:00
Nick Mathewson 2c15b65381 Make the NET_PARTICIPANT role dependent on user activity
This patch implements all of 28337, except for the part where we
turn off the role if we've been idle for a long time.
2018-11-15 11:17:22 -05:00
Nick Mathewson ccbb36048f write_stats_file() is indeed NET_PARTICIPANT; remove comment. 2018-11-15 11:17:22 -05:00
Nick Mathewson dc21f1f662 reset_padding_counts is only once per 24h; it can be all. 2018-11-15 11:17:22 -05:00
Nick Mathewson 4bf79fa4fa Turn second_elapsed_callback into a normal periodic event. 2018-11-15 11:17:22 -05:00
Nick Mathewson 303e5c70e0 Move the responsibility for delayed shutdown into the mainloop
This is part of 28422, so we don't have to call
consider_hibernation() once per second when we're dormant.

This commit does not remove delayed shutdown from hibernate.c: it
uses it as a backup shutdown mechanism, in case the regular shutdown
timer mechanism fails for some reason.
2018-11-15 11:17:22 -05:00
Nick Mathewson e535ec8542 Remove run_scheduled_events() as a separate function.
(There was nothing else in second_elapsed_callbck() that couldn't go
here.)
2018-11-15 11:17:22 -05:00
Nick Mathewson a0380b705d Move control_per_second_events() into a callback with its own role
Part of making extra-dormant mode work; closes ticket 28421.
2018-11-15 11:17:22 -05:00
Nick Mathewson db53bfe8f7 Annotate 1/s callback elements with NET_PARTICIPANT status. 2018-11-15 11:17:22 -05:00
Nick Mathewson b9a88bd53a Add new "ALL" and "NET_PARTICIPANT" roles for periodic events
The previous "ALL" role was the OR of a bunch of other roles,
which is a mistake: it's better if "ALL" means "all".

The "NET_PARTICIPANT" role refers to the anything that is actively
building circuits, downloading directory information, and
participating in the Tor network.  For now, it is set to
!net_is_disabled(), but we're going to use it to implement a new
"extra dormant mode".

Closes ticket 28336.
2018-11-15 11:17:22 -05:00
Nick Mathewson 6d84972eb8 Add a function to schedule a periodic event once, then disable it 2018-11-15 11:17:22 -05:00
Nick Mathewson 2070765c7c Use macros to make the periodic event table less verbose. 2018-11-15 11:17:22 -05:00
Nick Mathewson f6b8c7da66 Move buffers.c out of lib/containers to resolve a circularity. 2018-11-14 16:07:03 -05:00
Nick Mathewson d598d834f5 Merge branch 'ticket27750_034_01_squashed' into maint-0.3.5 2018-11-14 15:43:46 -05:00
rl1987 100136ca86 Create new periodic event for pruning old info about Tor routers 2018-11-11 20:31:24 +02:00
Nick Mathewson 9431d35074 Merge branch 'bug28348_034' into bug28348_035 2018-11-06 07:42:55 -05:00
Nick Mathewson e97adaf8dc Argh. The unset value for OwningControllerFD is NOT -1. 2018-10-16 17:57:04 -04:00
Nick Mathewson 56a3cef4d7 Merge branch 'bug27849_redux' 2018-10-16 17:33:58 -04:00
Nick Mathewson 9e65e7a36f Merge branch 'split_stats' 2018-09-27 16:26:06 -04:00
Nick Mathewson d0b2b5a202 Always initialize the periodic events list.
Various places in our code try to activate these events or check
their status, so we should make sure they're initialized as early as
possible.  Fixes bug 27861; bugfix on 0.3.5.1-alpha.
2018-09-27 13:24:36 -04:00
Nick Mathewson f403af2207 Split geoip from geoip-related stats.
This commit just moves the code to two separate files. The geoip
code still has a few needless dependencies on core/* and features/*.
2018-09-27 09:36:52 -04:00
Nick Mathewson 241c1505cc Move the predicted ports code out of rephist.c
It differs from the rest of the rephist code in that it's actually
necessary for Tor to operate, so it should probably go somewhere
else.  I'm not sure where yet, so I'll leave it in the same
directory, but give it its own file.
2018-09-27 08:21:17 -04:00
Nick Mathewson 4f0bc0c8f5 Revise things that had included router.h before
Make them only include the headers that they needed, and sort their
headers while we're at it.
2018-09-25 17:57:58 -04:00
Nick Mathewson fcd0f76134 Extract all the "am I a server" functions from router.c 2018-09-25 16:00:50 -04:00