File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -743,13 +743,17 @@ function clientConnect(socket) {
743
743
console . log ( "Connection created." ) ;
744
744
} ) ;
745
745
connection . on ( 'data' , function ( d ) {
746
- if ( d . toString ( ) . substr ( d . length - 1 ) != "\n" )
747
- this . _buffer += d . toString ( ) ;
748
- else {
749
- _d = this . _buffer + d . toString ( ) ;
750
- this . _buffer = '' ;
751
- lines = _d . split ( "\n" ) ;
752
- for ( n = 0 ; n < lines . length ; n ++ ) {
746
+ _d = this . _buffer + d . toString ( ) ;
747
+ let lines = _d . toString ( ) . split ( '\n' ) ;
748
+ if ( lines [ lines . length - 1 ] !== '' ) {
749
+ this . _buffer = lines . pop ( ) ;
750
+ } else {
751
+ lines . pop ( ) ;
752
+ this . _buffer = '' ;
753
+ }
754
+
755
+ if ( true ) {
756
+ for ( let n = 0 ; n < lines . length ; n ++ ) {
753
757
if ( DEBUG )
754
758
console . log ( "> " + lines [ n ] ) ;
755
759
data = lines [ n ] . trim ( ) . split ( " " ) ;
You can’t perform that action at this time.
0 commit comments