- 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> <modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId> <groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId> <artifactId>MegaBasterd</artifactId>
<version>7.2</version> <version>7.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@ -24,7 +24,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
public static final double SLOW_PROXY_PERC = 0.5; public static final double SLOW_PROXY_PERC = 0.5;
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 = true; //True for debugging SmartProxy
private final int _id; private final int _id;
private final Download _download; private final Download _download;
private volatile boolean _exit; 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 ((_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 (_current_smart_proxy != null && (slow_proxy || chunk_error)) {
if (http_error == 509) { if (http_error == 509) {
@ -184,6 +180,10 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
} else if (_current_smart_proxy == null) { } else if (_current_smart_proxy == null) {
if (!getDownload().isTurbo()) {
getDownload().enableTurboMode();
}
_current_smart_proxy = proxy_manager.getProxy(_excluded_proxy_list); _current_smart_proxy = proxy_manager.getProxy(_excluded_proxy_list);
} }
@ -414,7 +414,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
_download.getView().updateSlotsStatus(); _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); 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().getSpeed_label().setForeground(new Color(255, 102, 0));
getView().getSlots_spinner().setEnabled(false);
}); });
synchronized (_workers_lock) { synchronized (_workers_lock) {
@ -1240,20 +1238,16 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
swingInvokeAndWait(() -> { swingInvokeAndWait(() -> {
getView().getSlots_spinner().setEnabled(false); 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(() -> { swingInvokeAndWait(() -> {
getView().getSlots_spinner().setEnabled(true);
getView().getSlots_spinner().setValue(Math.max((int) getView().getSlots_spinner().getValue() - 1, 0));
}); });
} }
getView().updateSlotsStatus(); getView().updateSlotsStatus();
_turbo = false;
} }
if (!_exit && isPause() && _paused_workers == _chunkworkers.size()) { if (!_exit && isPause() && _paused_workers == _chunkworkers.size()) {

View File

@ -54,7 +54,7 @@ import javax.swing.UIManager;
*/ */
public final class MainPanel { 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 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;

View File

@ -76,6 +76,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
private volatile String _temp_mac_data; private volatile String _temp_mac_data;
private final boolean _priority; private final boolean _priority;
private final Object _progress_watchdog_lock; 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) { 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; _auto_retry_on_error = true;
_canceled = false; _canceled = false;
_closed = false; _closed = false;
_finalizing = false;
_main_panel = main_panel; _main_panel = main_panel;
_ma = ma; _ma = ma;
_file_name = filename; _file_name = filename;
@ -124,6 +126,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
_status_error = null; _status_error = null;
_auto_retry_on_error = true; _auto_retry_on_error = true;
_canceled = upload.isCanceled(); _canceled = upload.isCanceled();
_finalizing = false;
_closed = false; _closed = false;
_restart = true; _restart = true;
_main_panel = upload.getMain_panel(); _main_panel = upload.getMain_panel();
@ -1129,18 +1132,17 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
if (chunkuploader.isChunk_exception()) { if (chunkuploader.isChunk_exception()) {
_finalizing = true;
swingInvokeAndWait(() -> { swingInvokeAndWait(() -> {
getView().getSlots_spinner().setEnabled(false); 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(() -> { swingInvokeAndWait(() -> {
getView().getSlots_spinner().setEnabled(true);
getView().getSlots_spinner().setValue(Math.max((int) getView().getSlots_spinner().getValue() - 1, 0));
}); });
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 191 KiB