Fix client not registering when no file in directory (#122)
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/head This commit looks good
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/head This commit looks good
Fix client not registering when no file in directory
This commit is contained in:
parent
a783164922
commit
b39eaf270b
@ -50,6 +50,7 @@ public abstract class FileWatcher implements Runnable {
|
|||||||
this.server = server;
|
this.server = server;
|
||||||
this.tracker = tracker;
|
this.tracker = tracker;
|
||||||
this.baseDirectory = baseDirectory;
|
this.baseDirectory = baseDirectory;
|
||||||
|
force = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** FileList getter
|
/** FileList getter
|
||||||
|
@ -316,25 +316,6 @@ public abstract class TrackerManagement extends ServeErrors implements Runnable
|
|||||||
closeHostItemSocket(host);
|
closeHostItemSocket(host);
|
||||||
} catch (EmptyDirectory e) {
|
} catch (EmptyDirectory e) {
|
||||||
writeLog("Empty Directory", LogLevel.Debug);
|
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) {
|
} catch (Exception e) {
|
||||||
// remove from list because list request could not be send
|
// remove from list because list request could not be send
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user