Fix #59 (#102)
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/head This commit looks good Details

Fix #59
pull/104/head 1.5.1
Louis Royer 5 years ago
parent 9d4c98c466
commit 4928efa947

@ -66,7 +66,6 @@ public abstract class ServerManagement extends ServeErrors implements Runnable {
stop = true; stop = true;
fileListWatcher.setStop(); fileListWatcher.setStop();
ratioWatcher.setStop(); ratioWatcher.setStop();
sendUnregisterRequest();
closeSocket(); closeSocket();
writeLog("Server stopped", LogLevel.Info); writeLog("Server stopped", LogLevel.Info);
} }

@ -78,6 +78,11 @@ public class ServerManagementTCP extends ServerManagement {
*/ */
public void run() { public void run() {
writeLog("Server sucessfully started", LogLevel.Info); writeLog("Server sucessfully started", LogLevel.Info);
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
sendUnregisterRequest();
}
});
fileListWatcher = (FileWatcher)new FileWatcherTCP(logger, 10000, server, tracker, baseDirectory); // checking every 10 seconds fileListWatcher = (FileWatcher)new FileWatcherTCP(logger, 10000, server, tracker, baseDirectory); // checking every 10 seconds
Thread flwt = new Thread(fileListWatcher); Thread flwt = new Thread(fileListWatcher);
flwt.start(); flwt.start();

@ -73,6 +73,11 @@ public class ServerManagementUDP extends ServerManagement {
*/ */
public void run() { public void run() {
logger.writeUDP("Server sucessfully started", LogLevel.Info); logger.writeUDP("Server sucessfully started", LogLevel.Info);
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
sendUnregisterRequest();
}
});
fileListWatcher = (FileWatcher)new FileWatcherUDP(logger, 10000, server, tracker, baseDirectory); // checking every 10 seconds fileListWatcher = (FileWatcher)new FileWatcherUDP(logger, 10000, server, tracker, baseDirectory); // checking every 10 seconds
Thread flwt = new Thread(fileListWatcher); Thread flwt = new Thread(fileListWatcher);
flwt.start(); flwt.start();

Loading…
Cancel
Save