GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Verified Commit 88d8f0a8 authored by Philipp Winter's avatar Philipp Winter
Browse files

Try waking up tor before giving it new bridges.

By default, tor goes to sleep after 24 hours of no user activity.
Bridgestrap's control port interaction does not count as user activity,
which means that tor effectively stops working after 24 hours.  To work
around this, we're sending tor a SIGNAL ACTIVE, which wakes up tor in
case it went to sleep.  This is a cheap thing to do, so we might as well
do it before each SETCONF.

This patch fixes #12.
parent 6d3ae38c
...@@ -200,6 +200,16 @@ func (c *TorContext) TestBridgeLines(bridgeLines []string) *TestResult { ...@@ -200,6 +200,16 @@ func (c *TorContext) TestBridgeLines(bridgeLines []string) *TestResult {
result := NewTestResult() result := NewTestResult()
log.Printf("Testing %d bridge lines.", len(bridgeLines)) log.Printf("Testing %d bridge lines.", len(bridgeLines))
// By default, Tor enters dormant mode 24 hours after seeing no user
// activity. Bridgestrap's control port interaction doesn't count as user
// activity, which is why we explicitly wake up Tor before issuing our
// SETCONF. See the following issue for more details:
// https://gitlab.torproject.org/tpo/anti-censorship/bridgestrap/-/issues/12
if _, err := c.Ctrl.Request("SIGNAL ACTIVE"); err != nil {
result.Error = err.Error()
return result
}
// Create our SETCONF line, which tells Tor what bridges it should test. // Create our SETCONF line, which tells Tor what bridges it should test.
// It has the following format: // It has the following format:
// SETCONF Bridge="BRIDGE1" Bridge="BRIDGE2" ... // SETCONF Bridge="BRIDGE1" Bridge="BRIDGE2" ...
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment