mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-30 22:54:26 +02:00
6.78
-Progress watchdog meter fix
This commit is contained in:
parent
9ba47c3381
commit
803a005efc
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.tonikelope</groupId>
|
<groupId>com.tonikelope</groupId>
|
||||||
<artifactId>MegaBasterd</artifactId>
|
<artifactId>MegaBasterd</artifactId>
|
||||||
<version>6.77</version>
|
<version>6.78</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.tonikelope.megabasterd;
|
package com.tonikelope.megabasterd;
|
||||||
|
|
||||||
import static com.tonikelope.megabasterd.MainPanel.*;
|
import static com.tonikelope.megabasterd.MainPanel.*;
|
||||||
|
import static com.tonikelope.megabasterd.MiscTools.formatBytes;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -22,7 +23,6 @@ import java.util.logging.Logger;
|
|||||||
public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||||
|
|
||||||
public static final double SLOW_PROXY_PERC = 0.3;
|
public static final double SLOW_PROXY_PERC = 0.3;
|
||||||
public static final int READ_TIMEOUT_RETRY = 3;
|
|
||||||
private static final Logger LOG = Logger.getLogger(ChunkDownloader.class.getName());
|
private static final Logger LOG = Logger.getLogger(ChunkDownloader.class.getName());
|
||||||
private final boolean FORCE_SMART_PROXY = false; //True for debugging SmartProxy
|
private final boolean FORCE_SMART_PROXY = false; //True for debugging SmartProxy
|
||||||
private final int _id;
|
private final int _id;
|
||||||
@ -276,7 +276,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
_download.getProgress_meter().secureNotify();
|
_download.getProgress_meter().secureNotify();
|
||||||
|
|
||||||
if (_download.isPaused() && !_download.isStopped()) {
|
if (_download.isPaused() && !_exit && !_download.isStopped() && !_download.getChunkmanager().isExit() && chunk_reads < chunk_size) {
|
||||||
|
|
||||||
_download.pause_worker();
|
_download.pause_worker();
|
||||||
|
|
||||||
@ -328,9 +328,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
http_error = 0;
|
http_error = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
//Proxy speed benchmark
|
//Proxy speed benchmark
|
||||||
|
|
||||||
if (_current_smart_proxy != null && finish_chunk_time != -1) {
|
if (_current_smart_proxy != null && finish_chunk_time != -1) {
|
||||||
|
|
||||||
//Update average chunk download speed using SmartProxy
|
//Update average chunk download speed using SmartProxy
|
||||||
@ -350,7 +348,8 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (!FORCE_SMART_PROXY) {
|
if (!FORCE_SMART_PROXY) {
|
||||||
_current_smart_proxy = null;
|
_current_smart_proxy = null;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
|
|
||||||
getDownload().getProgress_meter().secureNotify();
|
getDownload().getProgress_meter().secureNotify();
|
||||||
|
|
||||||
if (getDownload().isPaused() && !getDownload().isStopped()) {
|
if (getDownload().isPaused() && !getDownload().isStopped() && chunk_reads < chunk_size) {
|
||||||
|
|
||||||
getDownload().pause_worker_mono();
|
getDownload().pause_worker_mono();
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
tot_bytes_up += reads;
|
tot_bytes_up += reads;
|
||||||
|
|
||||||
if (_upload.isPaused() && !_upload.isStopped()) {
|
if (_upload.isPaused() && !_exit && !_upload.isStopped() && tot_bytes_up < chunk_size) {
|
||||||
|
|
||||||
_upload.pause_worker();
|
_upload.pause_worker();
|
||||||
|
|
||||||
|
@ -655,9 +655,9 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (!isExit() && (!isTurbo() || isPaused() || progress > last_progress));
|
} while (!isExit() && progress < getFile_size() && (!isTurbo() || isPaused() || progress > last_progress));
|
||||||
|
|
||||||
if (!isExit() && progress <= last_progress) {
|
if (!isExit() && progress < getFile_size() && progress <= last_progress) {
|
||||||
stopDownloader("PROGRESS WATCHDOG TIMEOUT!");
|
stopDownloader("PROGRESS WATCHDOG TIMEOUT!");
|
||||||
MainPanel.getProxy_manager().refreshProxyList(); //Force SmartProxy proxy list refresh
|
MainPanel.getProxy_manager().refreshProxyList(); //Force SmartProxy proxy list refresh
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "6.77";
|
public static final String VERSION = "6.78";
|
||||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||||
public static final int STREAMER_PORT = 1337;
|
public static final int STREAMER_PORT = 1337;
|
||||||
|
@ -18,7 +18,7 @@ import org.apache.commons.collections4.queue.CircularFifoQueue;
|
|||||||
public class SpeedMeter implements Runnable {
|
public class SpeedMeter implements Runnable {
|
||||||
|
|
||||||
public static final int SLEEP = 3000;
|
public static final int SLEEP = 3000;
|
||||||
public static final int CHUNK_SPEED_QUEUE_MAX_SIZE = 10;
|
public static final int CHUNK_SPEED_QUEUE_MAX_SIZE = 20;
|
||||||
private static final Logger LOG = Logger.getLogger(SpeedMeter.class.getName());
|
private static final Logger LOG = Logger.getLogger(SpeedMeter.class.getName());
|
||||||
private final JLabel _speed_label;
|
private final JLabel _speed_label;
|
||||||
private final JLabel _rem_label;
|
private final JLabel _rem_label;
|
||||||
@ -28,14 +28,14 @@ public class SpeedMeter implements Runnable {
|
|||||||
private long _speed_acumulator;
|
private long _speed_acumulator;
|
||||||
private volatile long _max_avg_global_speed;
|
private volatile long _max_avg_global_speed;
|
||||||
private volatile long _avg_chunk_speed;
|
private volatile long _avg_chunk_speed;
|
||||||
private final CircularFifoQueue _chunk_speed_queue;
|
private final CircularFifoQueue _pepillo_chunk_speed_queue;
|
||||||
|
|
||||||
SpeedMeter(TransferenceManager trans_manager, JLabel sp_label, JLabel rem_label) {
|
SpeedMeter(TransferenceManager trans_manager, JLabel sp_label, JLabel rem_label) {
|
||||||
_speed_label = sp_label;
|
_speed_label = sp_label;
|
||||||
_rem_label = rem_label;
|
_rem_label = rem_label;
|
||||||
_trans_manager = trans_manager;
|
_trans_manager = trans_manager;
|
||||||
_transferences = new ConcurrentHashMap<>();
|
_transferences = new ConcurrentHashMap<>();
|
||||||
_chunk_speed_queue = new CircularFifoQueue(CHUNK_SPEED_QUEUE_MAX_SIZE);
|
_pepillo_chunk_speed_queue = new CircularFifoQueue(CHUNK_SPEED_QUEUE_MAX_SIZE);
|
||||||
_speed_counter = 0L;
|
_speed_counter = 0L;
|
||||||
_speed_acumulator = 0L;
|
_speed_acumulator = 0L;
|
||||||
_max_avg_global_speed = 0L;
|
_max_avg_global_speed = 0L;
|
||||||
@ -56,22 +56,22 @@ public class SpeedMeter implements Runnable {
|
|||||||
|
|
||||||
public void update_avg_chunk_speed(long speed) {
|
public void update_avg_chunk_speed(long speed) {
|
||||||
|
|
||||||
synchronized (_chunk_speed_queue) {
|
synchronized (_pepillo_chunk_speed_queue) {
|
||||||
|
|
||||||
this._chunk_speed_queue.add(speed);
|
this._pepillo_chunk_speed_queue.add(speed);
|
||||||
|
|
||||||
if (_chunk_speed_queue.size() == _chunk_speed_queue.maxSize()) {
|
if (_pepillo_chunk_speed_queue.size() == _pepillo_chunk_speed_queue.maxSize()) {
|
||||||
|
|
||||||
long acumulador = 0;
|
long acumulador = 0;
|
||||||
|
|
||||||
Iterator i = _chunk_speed_queue.iterator();
|
Iterator i = _pepillo_chunk_speed_queue.iterator();
|
||||||
|
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
|
|
||||||
acumulador += (long) i.next();
|
acumulador += (long) i.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
_avg_chunk_speed = Math.round(((double) acumulador) / _chunk_speed_queue.size());
|
_avg_chunk_speed = Math.round(((double) acumulador) / _pepillo_chunk_speed_queue.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 191 KiB After Width: | Height: | Size: 194 KiB |
Loading…
x
Reference in New Issue
Block a user