Opened 5 months ago

Closed 5 months ago

#26063 closed defect (implemented)

Disable the per-second timer when we can

Reported by: nickm Owned by: nickm
Priority: High Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-client, 034-roadmap-master, 034-triage-20180328, 034-included-20180328
Cc: nickm Actual Points:
Parent ID: #25500 Points:
Reviewer: dgoulet Sponsor: Sponsor8-must

Description

Once the children of #25375 are merged, there will be nothing left in second_elapsed_callback that needs to happen once per second when Tor isn't running. Once we're in that position, we can disable this callback whenever..

  1. we are completely hibernating (state == DORMANT) OR the network is disabled.
  2. The controller is not waiting for any per-second events.

This change will require some related refactoring.

Child Tickets

Change History (5)

comment:1 Changed 5 months ago by nickm

See my branch ticket26063 -- github PR at https://github.com/torproject/tor/pull/99

comment:2 Changed 5 months ago by nickm

Reviewer: dgoulet
Status: assignedneeds_review

comment:3 Changed 5 months ago by dgoulet

Status: needs_reviewneeds_revision

Two comments basically about commit message confusion. Going in needs_revision just for those but should be merge_ready once clarified/fixed.

The rest looks solid to me!

I'm wondering also once we merge this, we should probably go over the run_scheduled_events() function and assess all the net_is_disabled() checks in there. That callback will NOT run if DisableNetwork is set so that part we can remove but the slight difference is that we use we_are_hibernating() so technically some of the events in the second callback can get called if our hibernation is not "SHUTDOWN". I bet most of them shouldn't run...

comment:4 Changed 5 months ago by nickm

Status: needs_revisionmerge_ready

ready to merge as ticket26062_squashed, but first I want to merge #26064, or we won't wake up from hibernation...

comment:5 Changed 5 months ago by nickm

Resolution: implemented
Status: merge_readyclosed

branch renamed to ticket26063_squashed and merged!

Note: See TracTickets for help on using tickets.