File tree 3 files changed +17
-19
lines changed
3 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -56,15 +56,8 @@ class Client extends EventEmitter {
56
56
this . binary = c . binary || defaults . binary
57
57
this . processID = null
58
58
this . secretKey = null
59
+ // TODO: remove in next major release?
59
60
this . ssl = this . connectionParameters . ssl || false
60
- // As with Password, make SSL->Key (the private key) non-enumerable.
61
- // It won't show up in stack traces
62
- // or if the client is console.logged
63
- if ( this . ssl && this . ssl . key ) {
64
- Object . defineProperty ( this . ssl , 'key' , {
65
- enumerable : false ,
66
- } )
67
- }
68
61
69
62
this . _connectionTimeoutMillis = c . connectionTimeoutMillis || 0
70
63
}
@@ -115,14 +108,6 @@ class Client extends EventEmitter {
115
108
116
109
// once connection is established send startup message
117
110
con . on ( 'connect' , function ( ) {
118
- if ( self . ssl ) {
119
- con . requestSsl ( )
120
- } else {
121
- con . startup ( self . getStartupConf ( ) )
122
- }
123
- } )
124
-
125
- con . on ( 'sslconnect' , function ( ) {
126
111
con . startup ( self . getStartupConf ( ) )
127
112
} )
128
113
Original file line number Diff line number Diff line change @@ -16,6 +16,15 @@ class Connection extends EventEmitter {
16
16
super ( )
17
17
config = config || { }
18
18
19
+ // As with Password, make SSL->Key (the private key) non-enumerable.
20
+ // It won't show up in stack traces
21
+ // or if the client is console.logged
22
+ if ( config . ssl && config . ssl . key ) {
23
+ Object . defineProperty ( config . ssl , 'key' , {
24
+ enumerable : false ,
25
+ } )
26
+ }
27
+
19
28
this . stream = config . stream || getStream ( config . ssl )
20
29
if ( typeof this . stream === 'function' ) {
21
30
this . stream = this . stream ( config )
@@ -47,7 +56,11 @@ class Connection extends EventEmitter {
47
56
if ( self . _keepAlive ) {
48
57
self . stream . setKeepAlive ( true , self . _keepAliveInitialDelayMillis )
49
58
}
50
- self . emit ( 'connect' )
59
+ if ( self . ssl ) {
60
+ self . requestSsl ( )
61
+ } else {
62
+ self . emit ( 'connect' )
63
+ }
51
64
} )
52
65
53
66
const reportStreamError = function ( error ) {
@@ -104,7 +117,7 @@ class Connection extends EventEmitter {
104
117
self . attachListeners ( self . stream )
105
118
self . stream . on ( 'error' , reportStreamError )
106
119
107
- self . emit ( 'sslconnect ' )
120
+ self . emit ( 'connect ' )
108
121
} )
109
122
}
110
123
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ var SSLNegotiationPacketTests = [
42
42
testName : 'connection does not emit ECONNRESET errors during disconnect also when using SSL' ,
43
43
errorMessage : null ,
44
44
response : 'S' ,
45
- responseType : 'sslconnect ' ,
45
+ responseType : 'connect ' ,
46
46
} ,
47
47
{
48
48
testName : 'connection emits an error when SSL is not supported' ,
You can’t perform that action at this time.
0 commit comments