mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-06-12 21:37:37 +02:00
@ -125,6 +125,14 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
while (!_exit && !_download.isStopped()) {
|
||||
|
||||
if (_download.isPaused() && !_download.isStopped()) {
|
||||
|
||||
_download.pause_worker();
|
||||
|
||||
secureWait();
|
||||
|
||||
}
|
||||
|
||||
if (worker_url == null || http_error == 403) {
|
||||
|
||||
worker_url = _download.getDownloadUrlForWorker();
|
||||
@ -142,7 +150,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
if ((_current_smart_proxy != null || http_error == 509) && MainPanel.isUse_smart_proxy() && !MainPanel.isUse_proxy()) {
|
||||
|
||||
if (slow_proxy || chunk_error) {
|
||||
if (_current_smart_proxy != null && (slow_proxy || chunk_error)) {
|
||||
|
||||
proxy_manager.blockProxy(_current_smart_proxy);
|
||||
|
||||
|
@ -103,6 +103,14 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
while (!_upload.getMain_panel().isExit() && !_exit && !_upload.isStopped() && conta_error < MAX_CHUNK_ERROR) {
|
||||
|
||||
if (_upload.isPaused() && !_upload.isStopped()) {
|
||||
|
||||
_upload.pause_worker();
|
||||
|
||||
secureWait();
|
||||
|
||||
}
|
||||
|
||||
String worker_url = _upload.getUl_url();
|
||||
|
||||
int reads = 0, http_status;
|
||||
|
@ -55,6 +55,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
private volatile DownloadView _view;
|
||||
private volatile ProgressMeter _progress_meter;
|
||||
private final Object _secure_notify_lock;
|
||||
private final Object _progress_lock;
|
||||
private final Object _workers_lock;
|
||||
private final Object _chunkid_lock;
|
||||
private final Object _dl_url_lock;
|
||||
@ -123,6 +124,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
_use_slots = use_slots;
|
||||
_restart = restart;
|
||||
_secure_notify_lock = new Object();
|
||||
_progress_lock = new Object();
|
||||
_workers_lock = new Object();
|
||||
_chunkid_lock = new Object();
|
||||
_dl_url_lock = new Object();
|
||||
@ -165,6 +167,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
_use_slots = download.getMain_panel().isUse_slots_down();
|
||||
_restart = true;
|
||||
_secure_notify_lock = new Object();
|
||||
_progress_lock = new Object();
|
||||
_workers_lock = new Object();
|
||||
_chunkid_lock = new Object();
|
||||
_dl_url_lock = new Object();
|
||||
@ -567,15 +570,12 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
}
|
||||
}
|
||||
|
||||
_progress = _file.length();
|
||||
setProgress(_file.length());
|
||||
|
||||
_last_chunk_id_dispatched = calculateLastWrittenChunk(_progress);
|
||||
|
||||
getView().updateProgressBar(_progress, _progress_bar_rate);
|
||||
|
||||
} else {
|
||||
_progress = 0;
|
||||
getView().updateProgressBar(0);
|
||||
setProgress(0);
|
||||
}
|
||||
|
||||
_output_stream = new BufferedOutputStream(new FileOutputStream(_file, (_progress > 0)));
|
||||
@ -727,9 +727,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
|
||||
getView().printStatusNormal("Waiting to check file integrity...");
|
||||
|
||||
_progress = 0;
|
||||
|
||||
getView().updateProgressBar(0);
|
||||
setProgress(0);
|
||||
|
||||
getView().printStatusNormal("Checking file integrity, please wait...");
|
||||
|
||||
@ -1667,13 +1665,26 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
|
||||
@Override
|
||||
public void setProgress(long progress) {
|
||||
|
||||
long old_progress = _progress;
|
||||
synchronized (_progress_lock) {
|
||||
|
||||
_progress = progress;
|
||||
long old_progress = _progress;
|
||||
|
||||
getView().updateProgressBar(_progress, _progress_bar_rate);
|
||||
_progress = progress;
|
||||
|
||||
getMain_panel().getDownload_manager().increment_total_progress(_progress - old_progress);
|
||||
swingInvoke(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
getView().updateProgressBar(_progress, _progress_bar_rate);
|
||||
}
|
||||
});
|
||||
|
||||
if (!isChecking_cbc()) {
|
||||
|
||||
getMain_panel().getDownload_manager().increment_total_progress(_progress - old_progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,6 +46,8 @@ public final class DownloadManager extends TransferenceManager {
|
||||
|
||||
increment_total_size(-1 * d.getFile_size());
|
||||
|
||||
increment_total_progress(-1 * d.getProgress());
|
||||
|
||||
delete_down.add(((Download) d).getUrl());
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "6.22";
|
||||
public static final String VERSION = "6.23";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
|
@ -76,7 +76,6 @@ import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tonikelope
|
||||
|
@ -127,10 +127,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
synchronized (_total_size_lock) {
|
||||
|
||||
if (val < 0) {
|
||||
increment_total_progress(val);
|
||||
}
|
||||
|
||||
_total_size += val;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
|
||||
private final MainPanel _main_panel;
|
||||
private volatile UploadView _view;
|
||||
private volatile ProgressMeter _progress_meter;
|
||||
private final Object _progress_lock;
|
||||
private String _status_error_message;
|
||||
private volatile boolean _exit;
|
||||
private int _slots;
|
||||
@ -96,6 +97,7 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
|
||||
_workers_lock = new Object();
|
||||
_chunkid_lock = new Object();
|
||||
_chunkworkers = new ArrayList<>();
|
||||
_progress_lock = new Object();
|
||||
_partialProgressQueue = new ConcurrentLinkedQueue<>();
|
||||
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
|
||||
_thread_pool = Executors.newCachedThreadPool();
|
||||
@ -117,6 +119,7 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
|
||||
_ma = upload.getMa();
|
||||
_file_name = upload.getFile_name();
|
||||
_parent_node = upload.getParent_node();
|
||||
_progress_lock = new Object();
|
||||
_ul_key = null;
|
||||
_ul_url = null;
|
||||
_root_node = upload.getRoot_node();
|
||||
@ -1199,10 +1202,25 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
|
||||
|
||||
@Override
|
||||
public void setProgress(long progress) {
|
||||
long old_progress = _progress;
|
||||
_progress = progress;
|
||||
getView().updateProgressBar(_progress, _progress_bar_rate);
|
||||
getMain_panel().getUpload_manager().increment_total_progress(_progress - old_progress);
|
||||
|
||||
synchronized (_progress_lock) {
|
||||
|
||||
long old_progress = _progress;
|
||||
|
||||
_progress = progress;
|
||||
|
||||
swingInvoke(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
getView().updateProgressBar(_progress, _progress_bar_rate);
|
||||
}
|
||||
});
|
||||
|
||||
getMain_panel().getUpload_manager().increment_total_progress(_progress - old_progress);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,6 +112,8 @@ public final class UploadManager extends TransferenceManager {
|
||||
|
||||
increment_total_size(-1 * u.getFile_size());
|
||||
|
||||
increment_total_progress(-1 * u.getProgress());
|
||||
|
||||
delete_up.add(new String[]{u.getFile_name(), ((Upload) u).getMa().getFull_email()});
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 210 KiB |
Reference in New Issue
Block a user