Commit 145b993d authored by Kathleen Brade's avatar Kathleen Brade
Browse files

Limit the size of the in-memory tor log (1000 entries by default).

Controlled by hidden pref: extensions.torlauncher.max_tor_log_entries
parent 56a7e930
......@@ -72,6 +72,8 @@ TorProtocolService.prototype =
kServiceName : "Tor Launcher Protocol Service",
kClassID: Components.ID("{4F476361-23FB-43EF-A427-B36A14D3208E}"),
kPrefMaxTorLogEntries: "extensions.torlauncher.max_tor_log_entries",
// nsISupports implementation.
QueryInterface: function(aIID)
{
......@@ -1173,6 +1175,13 @@ TorProtocolService.prototype =
let logObj = { date: now, type: eventType, msg: msg };
if (!this.mTorLog)
this.mTorLog = [];
else
{
var maxEntries =
TorLauncherUtil.getIntPref(this.kPrefMaxTorLogEntries, 0);
if ((maxEntries > 0) && (this.mTorLog.length >= maxEntries))
this.mTorLog.splice(0, 1);
}
this.mTorLog.push(logObj);
break;
case "STATUS_CLIENT":
......
pref("extensions.torlauncher.loglevel", 4); // 1=verbose, 2=debug, 3=info, 4=note, 5=warn
pref("extensions.torlauncher.logmethod", 1); // 0=stdout, 1=errorconsole, 2=debuglog
pref("extensions.torlauncher.max_tor_log_entries", 1000);
pref("extensions.torlauncher.control_host", "127.0.0.1");
pref("extensions.torlauncher.control_port", 9151);
......
Supports Markdown
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