|
|
|
@ -16,12 +16,12 @@ import protocolP2P.Payload;
|
|
|
|
|
import protocolP2P.LoadRequest;
|
|
|
|
|
import protocolP2P.FileList;
|
|
|
|
|
import protocolP2P.FilePart;
|
|
|
|
|
import exception.InternalError;
|
|
|
|
|
import exception.ProtocolError;
|
|
|
|
|
import exception.SizeError;
|
|
|
|
|
import exception.TransmissionError;
|
|
|
|
|
import exception.VersionError;
|
|
|
|
|
import exception.SocketClosed;
|
|
|
|
|
import localException.InternalError;
|
|
|
|
|
import localException.ProtocolError;
|
|
|
|
|
import localException.SizeError;
|
|
|
|
|
import localException.TransmissionError;
|
|
|
|
|
import localException.VersionError;
|
|
|
|
|
import localException.SocketClosed;
|
|
|
|
|
import remoteException.EmptyDirectory;
|
|
|
|
|
import remoteException.InternalRemoteError;
|
|
|
|
|
import remoteException.NotFound;
|
|
|
|
@ -116,7 +116,7 @@ public class ServerManagementUDP implements Runnable {
|
|
|
|
|
for (String f: fileList) {
|
|
|
|
|
logger.writeUDP("- " + f, LogLevel.Debug);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw new IOException(); // to send a NOT_FOUND in the catch block
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
@ -182,7 +182,7 @@ public class ServerManagementUDP implements Runnable {
|
|
|
|
|
private void initSha512() {
|
|
|
|
|
for(String f: fileList) {
|
|
|
|
|
try {
|
|
|
|
|
MessageDigest md = MessageDigest.getInstance(HashAlgorithm.SHA512.getName());
|
|
|
|
|
MessageDigest md = MessageDigest.getInstance(HashAlgorithm.SHA512.getName());
|
|
|
|
|
sha512.put(f, md.digest(Files.readAllBytes(Paths.get(baseDirectory + f))));
|
|
|
|
|
md.reset();
|
|
|
|
|
} catch (NoSuchAlgorithmException e) {
|
|
|
|
@ -192,7 +192,7 @@ public class ServerManagementUDP implements Runnable {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Send an internal error message.
|
|
|
|
|
* @param pd ProtocolP2PPacketUDP to respond
|
|
|
|
|
*/
|
|
|
|
@ -245,4 +245,3 @@ public class ServerManagementUDP implements Runnable {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|