Fix #58 (#99)
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 #58
This commit is contained in:
parent
c2d05aeeb9
commit
654758c14b
@ -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…
Reference in New Issue
Block a user