node-dns
node-dns copied to clipboard
Please add this._socket.on('error') in TCPSocket.prototype.bind
Hi,
Please consider adding error listener/emitter on TCP sockets. Right now I'm getting errors like below:
2015-06-30_16:14:17.57533 events.js:85
2015-06-30_16:14:17.57541 throw er; // Unhandled 'error' event
2015-06-30_16:14:17.57542 ^
2015-06-30_16:14:17.57544 Error: connect ETIMEDOUT
2015-06-30_16:14:17.57545 at exports._errnoException (util.js:746:11)
2015-06-30_16:14:17.57546 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
As a quick workaround I monkey-patched TCPSocket:
var native_dns_utils = require('native-dns/lib/utils');
native_dns_utils.TCPSocket.prototype._monkey_catchMessages = native_dns_utils.TCPSocket.prototype.catchMessages;
native_dns_utils.TCPSocket.prototype.catchMessages = function () {
var self = this;
this._socket.on('error', function(err) {
self.bound = false;
self.emit('close', err);
});
this._monkey_catchMessages();
};
Kind Regards, Rafal Kupka
I just got stung by this. Causes hard to debug crashes of the entire application. Not cool.
Hit the same issue, looks like this module is not maintained anymore.