[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-launcher/master] Limit the size of the in-memory tor log (1000 entries by default).
commit 145b993d7691750a8041a80254a9fa6cb903afe2
Author: Kathy Brade <brade@xxxxxxxxxxxxxx>
Date: Thu Apr 18 17:09:47 2013 -0400
Limit the size of the in-memory tor log (1000 entries by default).
Controlled by hidden pref: extensions.torlauncher.max_tor_log_entries
---
src/components/tl-protocol.js | 9 +++++++++
src/defaults/preferences/prefs.js | 1 +
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/components/tl-protocol.js b/src/components/tl-protocol.js
index 94ab21d..d1a8f84 100644
--- a/src/components/tl-protocol.js
+++ b/src/components/tl-protocol.js
@@ -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":
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index d9ea4d1..2a4799d 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -1,5 +1,6 @@
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);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits