Skip to content

Commit b66c0b6

Browse files
committed
Fix for node14
1 parent b0a2fe4 commit b66c0b6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/connection.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ var Connection = function(config) {
6161
util.inherits(Connection, EventEmitter);
6262

6363
Connection.prototype.connect = function(port, host) {
64-
65-
if(this.stream.readyState === 'closed') {
64+
// Old info regarding readyState https://github.com/nodejs/node-v0.x-archive/issues/1752
65+
// this previously checked for this.stream.readyState === 'open'
66+
// however when upgrading to node 14 - LTS readyState was always open
67+
// which prevented code that connected from being called
68+
if (port && host) {
6669
this.stream.connect(port, host);
67-
} else if(this.stream.readyState == 'open') {
6870
this.emit('connect');
6971
}
7072

0 commit comments

Comments
 (0)