diff --git a/xtrn/lord/lordsrv.js b/xtrn/lord/lordsrv.js index 7dab0000d31c7e7ec559dbae3b96ab2bb208a27d..fc39cc65642175d2f4c35652b5fa90bf5436ce77 100644 --- a/xtrn/lord/lordsrv.js +++ b/xtrn/lord/lordsrv.js @@ -534,14 +534,7 @@ function handle_request() { do { if (this.LORD.pending > 0) { - if (this.LORD.buf.length < this.LORD.pending) { - if (this.buf.length === 0) { - close_sock(this); - return - } - break; - } - else { + if (this.LORD.buf.length >= this.LORD.pending) { tmp = this.LORD.buf.substr(0, this.LORD.pending); this.LORD.buf = this.LORD.buf.substr(this.LORD.pending); this.LORD.pending = 0; @@ -550,6 +543,8 @@ function handle_request() { return; } } + else + break; } else { // TODO: Better sanity checking... @@ -571,6 +566,10 @@ function handle_request() { } } } while(true); + + if (buf.length === 0) { + close_sock(this); + } } function main() {