Skip to content

Commit d8e3b05

Browse files
committed
don't crash if server return error berore initial hello packet
1 parent 61e6457 commit d8e3b05

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/connection.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ function Connection (opts)
114114
});
115115
this.addCommand(handshakeCommand);
116116
}
117+
118+
// in case there was no initiall handshake but we need to read sting, assume it utf-8
119+
// most common example: "Too many connections" error ( packet is sent immediately on connection attempt, we don't know server encoding yet)
120+
// will be overwrittedn with actial encoding value as soon as server handshake packet is received
121+
this.serverEncoding = 'utf8';
117122
}
118123
util.inherits(Connection, EventEmitter);
119124

0 commit comments

Comments
 (0)