From 48e8ab1d49f92396a138b6008dea0e48262cc8d1 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Sat, 31 Aug 2019 21:37:09 +0000 Subject: [PATCH] Fix closed connection detection. --- xtrn/lord/lordsrv.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/xtrn/lord/lordsrv.js b/xtrn/lord/lordsrv.js index 7dab0000d3..fc39cc6564 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() { -- GitLab