File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,10 @@ ClientHandshake.prototype.calculateNativePasswordAuthToken = function (authPlugi
68
68
ClientHandshake . prototype . handshakeInit = function ( helloPacket , connection ) {
69
69
var command = this ;
70
70
71
- this . on ( 'error' , function ( err ) {
72
- connection . _protocolError = err ;
73
- connection . emit ( 'error' , err ) ;
71
+ this . on ( 'error' , function ( e ) {
72
+ connection . _protocolError = e ;
74
73
} ) ;
74
+
75
75
this . handshake = Packets . Handshake . fromPacket ( helloPacket ) ;
76
76
if ( connection . config . debug ) {
77
77
console . log ( 'Server hello packet: capability flags:%d=(%s)' , this . handshake . capabilityFlags ,
Original file line number Diff line number Diff line change @@ -103,19 +103,17 @@ function Connection (opts)
103
103
return ;
104
104
}
105
105
106
- // TODO: move to protocolError()
107
106
if ( ! connection . _protocolError ) { // no particular error message before disconnect
108
- connection . _protocolError = 'PROTOCOL_CONNECTION_LOST' ;
107
+ connection . _protocolError = new Error ( 'Connection lost: The server closed the connection.' ) ;
108
+ connection . _protocolError . fatal = true ;
109
+ connection . _protocolError . code = 'PROTOCOL_CONNECTION_LOST' ;
109
110
}
110
- var err = new Error ( 'Connection lost: The server closed the connection.' ) ;
111
- err . fatal = true ;
112
- err . code = connection . _protocolError ;
113
- connection . _notifyError ( err ) ;
111
+
112
+ connection . _notifyError ( connection . _protocolError ) ;
114
113
} ) ;
115
114
var handshakeCommand ;
116
115
if ( ! this . config . isServer ) {
117
116
handshakeCommand = new Commands . ClientHandshake ( this . config . clientFlags ) ;
118
- handshakeCommand . on ( 'error' , function ( e ) { connection . emit ( 'error' , e ) ; } ) ;
119
117
handshakeCommand . on ( 'end' , function ( ) {
120
118
connection . _handshakePacket = handshakeCommand . handshake ;
121
119
connection . threadId = handshakeCommand . handshake . connectionId ;
You can’t perform that action at this time.
0 commit comments