diff --git a/packages/pg/lib/connection.js b/packages/pg/lib/connection.js index 86724c5c5..2b49c1f56 100644 --- a/packages/pg/lib/connection.js +++ b/packages/pg/lib/connection.js @@ -72,11 +72,11 @@ class Connection extends EventEmitter { case 'S': // Server supports SSL connections, continue with a secure connection break case 'N': // Server does not support SSL connections - self.stream.end() + self.stream.destroy() return self.emit('error', new Error('The server does not support SSL connections')) default: // Any other response byte, including 'E' (ErrorResponse) indicating a server error - self.stream.end() + self.stream.destroy() return self.emit('error', new Error('There was an error establishing an SSL connection')) } var tls = require('tls')