SharingManagerSingleton.getInstance().addPartialFile(sharedFile);
}
synchronized void startDownload() {
download_tasks = new JMTimer();
peer_monitor_task = new JMTimerTask() {
public void run() {
List<Peer> status_not_reponse_list = download_status_list.getPeersWithInactiveTime(PEER_RESEND_PACKET_INTERVAL, PeerDownloadStatus.FILE_STATUS_REQUEST);
for(Peer peer : status_not_reponse_list) {
if (peer.isConnected())
network_manager.sendFileStatusRequest(peer.getIP(), peer.getPort(),
getFileHash());
}
for(Peer peer : status_not_reponse_list) {
if (peer.isConnected())
network_manager.sendFileStatusRequest(peer.getIP(), peer.getPort(),
getFileHash());
}
List<Peer> frenzed_list = download_status_list
.getPeersWithInactiveTime(PEER_RESEND_PACKET_INTERVAL,
ACTIVE);
for (Peer peer : frenzed_list) {
fileRequestList.remove(peer);
fileChunkRequest(peer);
//resendFilePartsRequest(peer);
}
List<Peer> peer_list = download_status_list
.getPeersWithInactiveTime(UNUSED_PEER_ACTIVATION,
PeerDownloadStatus.ACTIVE_UNUSED);
for (Peer peer : peer_list) {
if (peer.isConnected())
fileChunkRequest(peer);
else
download_status_list.setPeerStatus(peer, PeerDownloadStatus.DISCONNECTED);
}
}
};
server_queue_sources_task = new JMTimerTask() {
public void run() {
queueSourcesFromServer();
}
};
download_tasks.addTask(peer_monitor_task, PEER_MONITOR_INTERVAL, true);
download_tasks.addTask(server_queue_sources_task,
ConfigurationManager.SERVER_SOURCES_QUERY_INTERVAL, true);
pex_queue_sources_task = new JMTimerTask() {
public void run() {
queueSourcesFromPEX();
}
};
download_tasks.addTask(pex_queue_sources_task,
ConfigurationManager.PEX_SOURCES_QUERY_INTERVAL, true);
if (jkad.isConnected()) {
kad_source_search_task = new JMTimerTask() {
Int128 search_id;
Search search = Search.getSingleton();
public void run() {
byte[] hash = sharedFile.getFileHash().getHash().clone();