Fix #59 #102

Merged
louis_royer merged 1 commits from fix59 into master 5 years ago

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

@ -78,6 +78,11 @@ public class ServerManagementTCP extends ServerManagement {
*/
public void run() {
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
Thread flwt = new Thread(fileListWatcher);
flwt.start();

@ -73,6 +73,11 @@ public class ServerManagementUDP extends ServerManagement {
*/
public void run() {
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
Thread flwt = new Thread(fileListWatcher);
flwt.start();

Loading…
Cancel
Save