Fix #58
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/head This commit looks good Details
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good Details

pull/99/head
Louis Royer 5 years ago
parent c2d05aeeb9
commit 8609273dc2

@ -35,6 +35,8 @@ import protocolP2P.FilePart;
import protocolP2P.SizeRequest;
import protocolP2P.SizeResponse;
import protocolP2P.ProtocolP2PPacket;
import protocolP2P.DiscoverRequest;
import protocolP2P.DiscoverResponse;
import protocolP2P.UpdateRatio;
import clientP2P.ClientDownloadPart;
import tools.HostItem;
@ -391,6 +393,24 @@ public abstract class ClientDownload extends ServeErrors implements Runnable {
// get size
setSize();
// get hostlist from tracker
try {
ProtocolP2PPacket<?> req = createProtocolP2PPacket(new DiscoverRequest(filename));
req.sendRequest(getHostItemSocket(tracker));
Payload resp = req.receiveResponse().getPayload();
if (!(resp instanceof DiscoverResponse)) {
throw new InternalError();
}
DiscoverResponse p = (DiscoverResponse)resp;
hostList = p.getHostList();
} catch(IOException e) {
throw new InternalError();
} catch(RemoteException e) {
throw new InternalError();
} catch(LocalException e) {
throw new InternalError();
}
// get hashsum from 1st server in list
hash512 = getHashSum512(hostList.get(0));
if (hash512.length == 0) {

Loading…
Cancel
Save