@@ -37,7 +37,7 @@ p.connect = function(port, host) {
37
37
this . stream . on ( 'connect' , function ( ) {
38
38
self . emit ( 'connect' ) ;
39
39
} ) ;
40
-
40
+
41
41
this . stream . on ( 'error' , function ( error ) {
42
42
self . emit ( 'error' , error ) ;
43
43
} ) ;
@@ -53,9 +53,9 @@ p.connect = function(port, host) {
53
53
if ( msg . text == 0x53 ) {
54
54
var tls = require ( 'tls' ) ;
55
55
self . stream . removeAllListeners ( ) ;
56
- self . stream = tls . connect ( {
57
- socket : self . stream ,
58
- servername : host ,
56
+ self . stream = tls . connect ( {
57
+ socket : self . stream ,
58
+ servername : host ,
59
59
rejectUnauthorized : self . ssl . rejectUnauthorized ,
60
60
ca : self . ssl . ca ,
61
61
pfx : self . ssl . pfx ,
@@ -67,9 +67,12 @@ p.connect = function(port, host) {
67
67
self . attachListeners ( self . stream ) ;
68
68
self . emit ( 'sslconnect' ) ;
69
69
} else {
70
- self . emit ( 'error' , new Error ( "The server doesn't support SSL/TLS connections." ) ) ;
70
+ self . emit (
71
+ 'error' ,
72
+ new Error ( "The server doesn't support SSL/TLS connections." )
73
+ ) ;
71
74
}
72
- } ) ;
75
+ } ) ;
73
76
74
77
} else {
75
78
this . attachListeners ( this . stream ) ;
@@ -91,13 +94,13 @@ p.attachListeners = function(stream) {
91
94
92
95
p . requestSsl = function ( config ) {
93
96
this . checkSslResponse = true ;
94
-
97
+
95
98
var bodyBuffer = this . writer
96
99
. addInt16 ( 0x04D2 )
97
100
. addInt16 ( 0x162F ) . flush ( ) ;
98
-
101
+
99
102
var length = bodyBuffer . length + 4 ;
100
-
103
+
101
104
var buffer = new Writer ( )
102
105
. addInt32 ( length )
103
106
. add ( bodyBuffer )
@@ -247,7 +250,7 @@ p.flush = function() {
247
250
p . sync = function ( ) {
248
251
//clear out any pending data in the writer
249
252
this . writer . flush ( 0 ) ;
250
-
253
+
251
254
this . writer . add ( emptyBuffer ) ;
252
255
this . _send ( 0x53 ) ;
253
256
} ;
@@ -391,7 +394,7 @@ p.parseMessage = function() {
391
394
392
395
case 0x48 : //H
393
396
msg . name = 'copyOutResponse' ;
394
- return this . parseGH ( msg ) ;
397
+ return this . parseGH ( msg ) ;
395
398
case 0x63 : //c
396
399
msg . name = 'copyDone' ;
397
400
return msg ;
@@ -540,7 +543,7 @@ p.parseGH = function (msg) {
540
543
return msg ;
541
544
} ;
542
545
p . parseInt8 = function ( ) {
543
- var value = Number ( this . buffer [ this . offset ] ) ;
546
+ var value = Number ( this . buffer [ this . offset ] ) ;
544
547
this . offset ++ ;
545
548
return value ;
546
549
} ;
@@ -570,7 +573,8 @@ p.parseInt16 = function() {
570
573
} ;
571
574
572
575
p . readString = function ( length ) {
573
- return this . buffer . toString ( this . encoding , this . offset , ( this . offset += length ) ) ;
576
+ return this . buffer . toString ( this . encoding , this . offset ,
577
+ ( this . offset += length ) ) ;
574
578
} ;
575
579
576
580
p . readBytes = function ( length ) {
@@ -585,7 +589,7 @@ p.parseCString = function() {
585
589
p . parsed = function ( msg ) {
586
590
//exclude length field
587
591
msg . chunk = this . readBytes ( msg . length - 4 ) ;
588
- return msg ;
592
+ return msg ;
589
593
} ;
590
594
//end parsing methods
591
595
module . exports = Connection ;
0 commit comments