Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/services/dashd.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,26 @@ Dash.prototype._initZmqSubSocket = function(node, zmqUrl) {
var self = this;
node.zmqSubSocket = zmq.socket('sub');

log.info(`ZMQ opening socket to '${zmqUrl}'`);

// workaround for https://github.com/zeromq/zeromq.js/issues/574
var tcpTimeout = 5 * 1000;
var timeout = setTimeout(function () {
// neither accepting nor rejecting - either invalid or firewalled (DROP)
log.error(`ZMQ address '${zmqUrl}' cannot be reached`);
process.exit(1);
}, tcpTimeout);

node.zmqSubSocket.on('connect', function(fd, endPoint) {
log.info('ZMQ connected to:', endPoint);
clearTimeout(timeout);
timeout = null;
});

node.zmqSubSocket.on('connect_delay', function(fd, endPoint) {
log.warn('ZMQ connection delay:', endPoint);
clearTimeout(timeout);
timeout = null;
});

node.zmqSubSocket.on('disconnect', function(fd, endPoint) {
Expand Down