From 09377cc6e9dca66b8f83b9d976e3ffe7b8d500e9 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Fri, 29 Jul 2016 22:27:43 +0000
Subject: [PATCH] If the file offered by the remote already exists, reject if
 it's the same size and date.

Previously, it would always skip which could result in the uplink holding
the files indefiniately.
---
 exec/binkit.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/exec/binkit.js b/exec/binkit.js
index eb55a1569c..51d8ff2636 100644
--- a/exec/binkit.js
+++ b/exec/binkit.js
@@ -406,9 +406,14 @@ function callout_want_callback(fobj, fsize, fdate, offset, bp)
 	// Or process the old ones first.
 	if (this.received_files.indexOf(fobj.name) != -1)
 		return this.file.REJECT;
-	// Skip existing files.
-	if (file_exists(fobj.name))
+	// Reject or skip existing files.
+	if (file_exists(fobj.name)) {
+		// If the size and date are the same, reject it.
+		if (fsize == file_size(fobj.name) && fdate == file_date(fobj.name))
+			return this.file.REJECT;
+		// Otherwise, skip it.
 		return this.file.SKIP;
+	}
 	// Accept everything else
 	return this.file.ACCEPT;
 }
-- 
GitLab