2525
2626var tcp = require ( 'net' ) ,
2727 util = require ( 'util' ) ;
28-
28+
2929var crlf = "\r\n" ;
3030var crlf_len = crlf . length ;
3131
@@ -53,22 +53,22 @@ Client.prototype.connect = function () {
5353 this . setNoDelay ( ) ;
5454 self . emit ( "connect" ) ;
5555 self . dispatchHandles ( ) ;
56- } ) ;
57-
56+ } ) ;
57+
5858 this . conn . addListener ( "data" , function ( data ) {
5959 self . buffer += data ;
6060 // util.debug(data);
6161 self . recieves += 1 ;
6262 self . handle_received_data ( ) ;
6363 } ) ;
64-
64+
6565 this . conn . addListener ( "end" , function ( ) {
6666 if ( self . conn && self . conn . readyState ) {
6767 self . conn . end ( ) ;
6868 self . conn = null ;
6969 }
7070 } ) ;
71-
71+
7272 this . conn . addListener ( "close" , function ( ) {
7373 self . conn = null ;
7474 self . emit ( "close" ) ;
@@ -88,7 +88,7 @@ Client.prototype.connect = function () {
8888
8989Client . prototype . addHandler = function ( callback ) {
9090 this . handles . push ( callback ) ;
91-
91+
9292 if ( this . conn . readyState == 'open' ) {
9393 this . dispatchHandles ( ) ;
9494 }
@@ -163,7 +163,7 @@ Client.prototype.cas = function(key, value, unique, callback, lifetime, flags) {
163163
164164Client . prototype . del = function ( key , callback ) {
165165 util . error ( "mc.del() is deprecated - use mc.delete() instead" ) ;
166- return this . delete ( key , callback ) ;
166+ return this . delete ( key , callback ) ;
167167} ;
168168
169169Client . prototype . delete = function ( key , callback ) {
@@ -211,7 +211,7 @@ Client.prototype.stats = function(type, callback){
211211}
212212
213213Client . prototype . handle_received_data = function ( ) {
214-
214+
215215 while ( this . buffer . length > 0 ) {
216216
217217 var result = this . determine_reply_handler ( this . buffer ) ;
@@ -247,7 +247,7 @@ Client.prototype.determine_reply_handler = function (buffer){
247247 if ( crlf_at == - 1 ) {
248248 return null ;
249249 }
250-
250+
251251 // determine errors
252252 for ( var error_idx in error_replies ) {
253253 var error_indicator = error_replies [ error_idx ] ;
@@ -270,20 +270,20 @@ Client.prototype.handle_get = function(buffer) {
270270 var result_value = null ;
271271 var end_indicator_len = 3 ;
272272 var result_len = 0 ;
273-
273+
274274 if ( buffer . indexOf ( 'END' ) == 0 ) {
275275 return [ result_value , end_indicator_len + crlf_len ] ;
276276 } else if ( buffer . indexOf ( 'VALUE' ) == 0 && buffer . indexOf ( 'END' ) != - 1 ) {
277277 first_line_len = buffer . indexOf ( crlf ) + crlf_len ;
278278 var end_indicator_start = buffer . indexOf ( 'END' ) ;
279279 result_len = end_indicator_start - first_line_len - crlf_len ;
280280 result_value = buffer . substr ( first_line_len , result_len ) ;
281- return [ result_value , first_line_len + parseInt ( result_len , 10 ) + crlf_len + end_indicator_len + crlf_len ]
281+ return [ result_value , first_line_len + parseInt ( result_len , 10 ) + crlf_len + end_indicator_len + crlf_len ]
282282 } else {
283283 var first_line_len = buffer . indexOf ( crlf ) + crlf_len ;
284284 var result_len = buffer . substr ( 0 , first_line_len ) . split ( ' ' ) [ 3 ] ;
285285 result_value = buffer . substr ( first_line_len , result_len ) ;
286-
286+
287287 return [ result_value , first_line_len + parseInt ( result_len ) + crlf_len + end_indicator_len + crlf_len ] ;
288288 }
289289} ;
@@ -333,7 +333,7 @@ Client.prototype.handle_version = function(buffer){
333333} ;
334334
335335Client . prototype . handle_error = function ( buffer ) {
336- line = readLine ( buffer ) ;
336+ var line = readLine ( buffer ) ;
337337 return [ null , ( line . length + crlf_len ) , line ] ;
338338} ;
339339
0 commit comments