diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-11-13 15:33:46 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-11-15 11:17:22 -0500 |
commit | 2c15b6538123047c258987b00475fa658ca14878 (patch) | |
tree | 6a01a36619cd1df7228b9a50e20a15087d3e014e /src/app | |
parent | ccbb36048f5167b9d5011b7c8b0d2c346ce567e8 (diff) | |
download | tor-2c15b6538123047c258987b00475fa658ca14878.tar.gz tor-2c15b6538123047c258987b00475fa658ca14878.zip |
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.
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/main/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c index b8dcb852d2..03b3a95d03 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -303,6 +303,19 @@ process_signal(int sig) log_heartbeat(time(NULL)); control_event_signal(sig); break; + case SIGACTIVE: + /* "SIGACTIVE" counts as ersatz user activity. */ + note_user_activity(approx_time()); + control_event_signal(sig); + break; + case SIGDORMANT: + /* "SIGDORMANT" means to ignore past user activity */ + log_notice(LD_GENERAL, "Going dormant because of controller request."); + reset_user_activity(0); + set_network_participation(false); + schedule_rescan_periodic_events(); + control_event_signal(sig); + break; } } @@ -472,6 +485,8 @@ static struct { { SIGNEWNYM, 0, NULL }, { SIGCLEARDNSCACHE, 0, NULL }, { SIGHEARTBEAT, 0, NULL }, + { SIGACTIVE, 0, NULL }, + { SIGDORMANT, 0, NULL }, { -1, -1, NULL } }; |