Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
[Fix] ZeromqAscoltatore: _connectedControls.push error and _control_c…
Browse files Browse the repository at this point in the history
…onn subscriptions leak.
  • Loading branch information
druide committed Mar 22, 2017
1 parent edbdca9 commit f5e684a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/zeromq_ascoltatore.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ function ZeromqAscoltatore(opts) {
this._opts.delay = this._opts.delay || 5;
this._opts.zmq = this._opts.zmq || require("zmq");

this._connectedControls = [];

this._ascoltatore = new TrieAscoltatore(opts);
this._startSubs();
this._startPub();
this._startControl();

this._connectedControls = [];
}

/**
Expand Down Expand Up @@ -122,8 +122,13 @@ ZeromqAscoltatore.prototype._startControl = function() {
}, 250);

that._control_conn.on("message", function(data) {
debug("received connect response from " + data);
that._connectSub(data);
var dest = String(data)
debug("received connect response from " + dest);
if (that._sub_conns.findIndex(function (conn) {
return conn.port === dest;
}) === -1) {
that._connectSub(dest);
}
});
});
}
Expand Down

0 comments on commit f5e684a

Please sign in to comment.