diff --git a/lib/services/dashd.js b/lib/services/dashd.js index adc2d12bc..d1bac1153 100644 --- a/lib/services/dashd.js +++ b/lib/services/dashd.js @@ -802,12 +802,25 @@ 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 timeout = setTimeout(function () { + // neither accepting nor rejecting - either invalid or firewalled (DROP) + log.error(`ZMQ address '${zmqUrl}' cannot be reached`); + process.exit(1); + }, 5 * 1000); + 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) {