From d68bb4a577a46bdc49b77760c8b31b5834ebddaa Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 15 Mar 2018 23:32:15 +0000
Subject: [PATCH] Push an M_SKIP into the failed_sent_files() from the
 pending_ack array, not from the currently sending file, since the pending ack
 should always be there, but sending often won't be.  Also, log a warning when
 pending_ack isn't empty and we get an M_EOB.

---
 exec/load/binkp.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/exec/load/binkp.js b/exec/load/binkp.js
index b8f320f7a0..7f439f9e22 100644
--- a/exec/load/binkp.js
+++ b/exec/load/binkp.js
@@ -715,8 +715,12 @@ BinkP.prototype.session = function()
 							if (!(this.sentempty && this.gotempty))
 								this.senteob = false;
 						}
-						if (this.senteob && this.pending_ack.length === 0)
-							break outer;
+						if (this.senteob) {
+							if (this.pending_ack.length === 0)
+								break outer;
+							else
+								log(LOG_WARNING, "We got an M_EOB, but there are still "+this.pending_ack.length+" files pending M_GOT");
+						}
 						this.gotempty = true;
 						break;
 					case this.command.M_GOT:
@@ -775,13 +779,13 @@ BinkP.prototype.session = function()
 						args = this.parseArgs(pkt.data);
 						for (i=0; i<this.pending_ack.length; i++) {
 							if (this.pending_ack[i].sendas == args[0]) {
+								this.failed_sent_files.push({path:this.pending_ack[i].file.name, sendas:this.pending_ack[i].sendas});
 								this.pending_ack.splice(i, 1);
 								i--;
 							}
 						}
 						if (this.sending !== undefined && this.sending.sendas === args[0]) {
 							this.sending.file.close();
-							this.failed_sent_files.push({path:this.sending.file.name, sendas:this.sending.sendas});
 							this.sending = undefined;
 						}
 						break;
-- 
GitLab