From b39eaf270b3e5d0e0cec484806600c0f307f08fe Mon Sep 17 00:00:00 2001 From: Louis Royer Date: Sun, 12 Apr 2020 16:53:47 +0200 Subject: [PATCH] Fix client not registering when no file in directory (#122) Fix client not registering when no file in directory --- src/serverP2P/FileWatcher.java | 1 + src/tracker/TrackerManagement.java | 19 ------------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/serverP2P/FileWatcher.java b/src/serverP2P/FileWatcher.java index 6146ed8..b50a936 100644 --- a/src/serverP2P/FileWatcher.java +++ b/src/serverP2P/FileWatcher.java @@ -50,6 +50,7 @@ public abstract class FileWatcher implements Runnable { this.server = server; this.tracker = tracker; this.baseDirectory = baseDirectory; + force = true; } /** FileList getter diff --git a/src/tracker/TrackerManagement.java b/src/tracker/TrackerManagement.java index 183be21..d94da76 100644 --- a/src/tracker/TrackerManagement.java +++ b/src/tracker/TrackerManagement.java @@ -316,25 +316,6 @@ public abstract class TrackerManagement extends ServeErrors implements Runnable closeHostItemSocket(host); } catch (EmptyDirectory e) { writeLog("Empty Directory", LogLevel.Debug); - try { - synchronized (this) { - while(writeLock.getAndSet(true)) { - this.wait(); - } - while(readLock.get() > 0) { - this.wait(); - } - if (!hostList.contains(host)) { - hostList.add(host); - } - hostList.remove(host); - writeLock.getAndSet(false); - this.notifyAll(); - } - } catch(InterruptedException e2) { - throw new InternalError(); - } - writeLog("Received EMPTY DIRECTORY from host " + pd.getHostItem() + ". Aborting.", LogLevel.Action); } catch (Exception e) { // remove from list because list request could not be send try {