@@ -58,7 +58,7 @@ Client.prototype._connect = function() {
58
58
var self = this ;
59
59
60
60
socket
61
- . on ( 'error' , this . _connectionErrorHandler ( ) )
61
+ . on ( 'error' , this . _connectionErrorHandler . bind ( this ) )
62
62
. on ( 'data' , parser . write . bind ( parser ) )
63
63
. on ( 'end' , this . _onEnd . bind ( this ) )
64
64
. connect ( this . port , this . host ) ;
@@ -238,7 +238,7 @@ Client.prototype._handlePacket = function(packet) {
238
238
return ;
239
239
}
240
240
241
- this . _connectionErrorHandler ( ) ( Client . _packetToUserObject ( packet ) ) ;
241
+ this . _connectionErrorHandler ( Client . _packetToUserObject ( packet ) ) ;
242
242
return ;
243
243
}
244
244
@@ -270,31 +270,29 @@ Client.prototype._handlePacket = function(packet) {
270
270
this . _dequeue ( ) ;
271
271
} ;
272
272
273
- Client . prototype . _connectionErrorHandler = function ( ) {
274
- return function ( err ) {
275
- this . destroy ( ) ;
273
+ Client . prototype . _connectionErrorHandler = function ( err ) {
274
+ this . destroy ( ) ;
276
275
277
- var task = this . _queue [ 0 ] ;
278
- var delegate = ( task )
279
- ? task . delegate
280
- : null ;
276
+ var task = this . _queue [ 0 ] ;
277
+ var delegate = ( task )
278
+ ? task . delegate
279
+ : null ;
281
280
282
- if ( delegate instanceof Query ) {
283
- delegate . emit ( 'error' , err ) ;
284
- return ;
285
- }
281
+ if ( delegate instanceof Query ) {
282
+ delegate . emit ( 'error' , err ) ;
283
+ return ;
284
+ }
286
285
287
- if ( ! delegate ) {
288
- this . emit ( 'error' , err ) ;
289
- } else {
290
- delegate ( err ) ;
291
- this . _queue . shift ( ) ;
292
- }
286
+ if ( ! delegate ) {
287
+ this . emit ( 'error' , err ) ;
288
+ } else {
289
+ delegate ( err ) ;
290
+ this . _queue . shift ( ) ;
291
+ }
293
292
294
- if ( this . _queue . length ) {
295
- this . _connect ( ) ;
296
- }
297
- } . bind ( this ) ;
293
+ if ( this . _queue . length ) {
294
+ this . _connect ( ) ;
295
+ }
298
296
} ;
299
297
300
298
Client . prototype . _sendAuth = function ( greeting ) {
0 commit comments