- Slot spinner bug fix
This commit is contained in:
tonikelope 2020-01-06 00:41:00 +01:00
parent 7a3675fc2f
commit b5116fd849
6 changed files with 19 additions and 23 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>7.2</version>
<version>7.3</version>
<packaging>jar</packaging>
<dependencies>
<dependency>

View File

@ -24,7 +24,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
public static final double SLOW_PROXY_PERC = 0.5;
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 = true; //True for debugging SmartProxy
private final int _id;
private final Download _download;
private volatile boolean _exit;
@ -166,10 +166,6 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
if ((_current_smart_proxy != null || http_error == 509) && MainPanel.isUse_smart_proxy() && !MainPanel.isUse_proxy()) {
if (!getDownload().isTurbo()) {
getDownload().enableTurboMode();
}
if (_current_smart_proxy != null && (slow_proxy || chunk_error)) {
if (http_error == 509) {
@ -184,6 +180,10 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
} else if (_current_smart_proxy == null) {
if (!getDownload().isTurbo()) {
getDownload().enableTurboMode();
}
_current_smart_proxy = proxy_manager.getProxy(_excluded_proxy_list);
}
@ -414,7 +414,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
_download.getView().updateSlotsStatus();
} else if (http_error == 503 && _current_smart_proxy == null) {
} else if (http_error == 503 && _current_smart_proxy == null && !_download.isTurbo()) {
setExit(true);
}
}

View File

@ -245,8 +245,6 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
getView().getSpeed_label().setForeground(new Color(255, 102, 0));
getView().getSlots_spinner().setEnabled(false);
});
synchronized (_workers_lock) {
@ -1240,20 +1238,16 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
swingInvokeAndWait(() -> {
getView().getSlots_spinner().setEnabled(false);
getView().getSlots_spinner().setValue(Math.max((int) getView().getSlots_spinner().getValue() - 1, 0));
getView().getSlots_spinner().setValue((int) getView().getSlots_spinner().getValue() - 1);
});
} else {
} else if (!_finalizing) {
swingInvokeAndWait(() -> {
getView().getSlots_spinner().setValue(Math.max((int) getView().getSlots_spinner().getValue() - 1, 0));
getView().getSlots_spinner().setEnabled(true);
});
}
getView().updateSlotsStatus();
_turbo = false;
}
if (!_exit && isPause() && _paused_workers == _chunkworkers.size()) {

View File

@ -54,7 +54,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "7.2";
public static final String VERSION = "7.3";
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;

View File

@ -76,6 +76,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
private volatile String _temp_mac_data;
private final boolean _priority;
private final Object _progress_watchdog_lock;
private volatile boolean _finalizing;
public Upload(MainPanel main_panel, MegaAPI ma, String filename, String parent_node, int[] ul_key, String ul_url, String root_node, byte[] share_key, String folder_link, boolean priority) {
@ -88,6 +89,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
_auto_retry_on_error = true;
_canceled = false;
_closed = false;
_finalizing = false;
_main_panel = main_panel;
_ma = ma;
_file_name = filename;
@ -124,6 +126,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
_status_error = null;
_auto_retry_on_error = true;
_canceled = upload.isCanceled();
_finalizing = false;
_closed = false;
_restart = true;
_main_panel = upload.getMain_panel();
@ -1129,18 +1132,17 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
if (chunkuploader.isChunk_exception()) {
_finalizing = true;
swingInvokeAndWait(() -> {
getView().getSlots_spinner().setEnabled(false);
getView().getSlots_spinner().setValue(Math.max((int) getView().getSlots_spinner().getValue() - 1, 0));
getView().getSlots_spinner().setValue((int) getView().getSlots_spinner().getValue() - 1);
});
} else {
} else if (!_finalizing) {
swingInvokeAndWait(() -> {
getView().getSlots_spinner().setValue(Math.max((int) getView().getSlots_spinner().getValue() - 1, 0));
getView().getSlots_spinner().setEnabled(true);
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 191 KiB