Unverified Commit 1a94ea5f authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug 40012: Watch all requested tor events

parent 3b22e767
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -643,9 +643,7 @@ TorProtocolService.prototype =
    }

    // TODO: optionally monitor INFO and DEBUG log messages.
    var events = "STATUS_CLIENT NOTICE WARN ERR";
    //var events = "STATUS_CLIENT WARN ERR";
    var reply = await conn.sendCommand("SETEVENTS " + events);
    var reply = await conn.sendCommand("SETEVENTS " + this.mEventMonitorEvents.join(' '));
    reply = this.TorParseCommandResponse(reply);
    if (!this.TorCommandSucceeded(reply))
    {
@@ -733,6 +731,7 @@ TorProtocolService.prototype =
  mEventMonitorConnection: null,
  mEventMonitorBuffer: null,
  mEventMonitorInProgressReply: null,
  mEventMonitorEvents: ["STATUS_CLIENT", "NOTICE", "WARN", "ERR"],
  mTorLog: null,      // Array of objects with date, type, and msg properties.

  mCheckPasswordHash: false,  // set to true to perform a unit test
@@ -1287,9 +1286,11 @@ TorProtocolService.prototype =
      return;

    var _this = this;
    this.mEventMonitorConnection.watchEvent("STATUS_CLIENT", null, function (data) { 
    for (let torEvent in this.mEventMonitorEvents) {
      this.mEventMonitorConnection.watchEvent(this.mEventMonitorEvents[torEvent], null, function (data) {
          return _this._processEventData.bind(_this, data)();
      }, true);
    }
  },

  _processEventData: function(line)