Commit ce36cfd7 authored by Tails developers's avatar Tails developers Committed by Kathleen Brade
Browse files

Split Tor process starting code from control code.

This separation is useful for supporting configuration of already
started, system-wide Tor instances.
parent 317fb4ea
......@@ -7,6 +7,7 @@ torlauncher.tor_exited=Tor unexpectedly exited.
torlauncher.please_restart_app=Please restart this application.
torlauncher.tor_controlconn_failed=Could not connect to Tor control port.
torlauncher.tor_failed_to_start=Tor failed to start.
torlauncher.tor_control_failed=Failed to take control of Tor.
torlauncher.tor_bootstrap_failed=Tor failed to establish a Tor network connection.
torlauncher.tor_bootstrap_failed_details=%1$S failed (%2$S).
......
......@@ -90,7 +90,10 @@ TorProcessService.prototype =
this.mObsSvc.addObserver(this, kBootstrapStatusTopic, false);
if (TorLauncherUtil.shouldStartAndOwnTor)
{
this._startTor();
this._controlTor();
}
}
else if ("quit-application-granted" == aTopic)
{
......@@ -340,7 +343,24 @@ TorProcessService.prototype =
p.runwAsync(args, args.length, this, false);
this.mTorProcess = p;
this.mTorProcessStartTime = Date.now();
}
catch (e)
{
this.mTorProcessStatus = this.kStatusExited;
var s = TorLauncherUtil.getLocalizedString("tor_failed_to_start");
TorLauncherUtil.showAlert(null, s);
TorLauncherLogger.safelog(4, "_startTor error: ", e);
}
}, // _startTor()
_controlTor: function()
{
var isInitialBootstrap =
TorLauncherUtil.getBoolPref(this.kPrefPromptAtStartup);
try
{
this._monitorTorProcessStartup();
if (isInitialBootstrap)
......@@ -378,11 +398,11 @@ TorProcessService.prototype =
catch (e)
{
this.mTorProcessStatus = this.kStatusExited;
var s = TorLauncherUtil.getLocalizedString("tor_failed_to_start");
var s = TorLauncherUtil.getLocalizedString("tor_control_failed");
TorLauncherUtil.showAlert(null, s);
TorLauncherLogger.safelog(4, "_startTor error: ", e);
TorLauncherLogger.safelog(4, "_controlTor error: ", e);
}
}, // _startTor()
}, // controlTor()
_monitorTorProcessStartup: function()
{
......
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