Skip to content

Commit 6cf7c15

Browse files
authored
Update bouncer.js
1 parent 337e0c3 commit 6cf7c15

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

bouncer.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -743,13 +743,17 @@ function clientConnect(socket) {
743743
console.log("Connection created.");
744744
});
745745
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++) {
753757
if(DEBUG)
754758
console.log("> "+lines[n]);
755759
data = lines[n].trim().split(" ");

0 commit comments

Comments
 (0)