close socket only if it exists

This commit is contained in:
SSantoro
2019-01-23 18:05:13 +01:00
parent 407e8ee6bc
commit db95905291

View File

@@ -178,7 +178,10 @@ NNTP.prototype.connect = function(options) {
// many? servers don't support the *mandatory* CAPABILITIES command :-(
if (err && cmd !== 'CAPABILITIES') {
self.emit('error', err);
return self._socket.end();
if (self._socket) {
self._socket.end()
}
return;
}
// TODO: try sending CAPABILITIES first thing
if (!cmd) {