-Timeouts
This commit is contained in:
tonikelope 2019-10-22 12:53:27 +02:00
parent 6bde910ac8
commit 6efc18daa7
8 changed files with 38 additions and 19 deletions

View File

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

View File

@ -113,7 +113,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
int http_error = 0, http_status = -1, conta_error = 0;
boolean chunk_error = false, slow_proxy = false, turbo_mode = false, timeout = false;
boolean chunk_error = false, slow_proxy = false, timeout = false;
String worker_url = null;
@ -127,9 +127,9 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
_current_smart_proxy = proxy_manager.getFastestProxy();
getDownload().enableTurboMode();
turbo_mode = true;
if (!getDownload().isTurbo()) {
getDownload().enableTurboMode();
}
}
while (!_download.getMain_panel().isExit() && !_exit && !_download.isStopped()) {
@ -171,10 +171,8 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
_current_smart_proxy = proxy_manager.getFastestProxy();
if (!turbo_mode) {
if (!getDownload().isTurbo()) {
getDownload().enableTurboMode();
turbo_mode = true;
}
}
@ -385,7 +383,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
_download.getProgress_meter().secureNotify();
}
if (!_exit && !_download.isStopped() && !timeout && (http_error != 509 || _current_smart_proxy != null) && http_error != 403 && http_error != 503) {
if (!_exit && !_download.isStopped() && !timeout && _current_smart_proxy == null && http_error != 509 && http_error != 403 && http_error != 503) {
_error_wait = true;

View File

@ -189,6 +189,10 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
}
public boolean isTurbo() {
return _turbo;
}
public String getCustom_chunks_dir() {
return _custom_chunks_dir;
}

View File

@ -53,7 +53,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "6.72";
public static final String VERSION = "6.73";
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;
@ -956,9 +956,19 @@ public final class MainPanel {
public void byebye(boolean restart) {
_byebye(restart, true);
}
public void byebye(boolean restart, boolean restart_warning) {
_byebye(restart, restart_warning);
}
private void _byebye(boolean restart, boolean restart_warning) {
if (!_exit && checkByeBye()) {
if (restart) {
if (restart && restart_warning) {
JOptionPane.showMessageDialog(getView(), LabelTranslatorSingleton.getInstance().translate("MegaBasterd will restart"), LabelTranslatorSingleton.getInstance().translate("Restart required"), JOptionPane.WARNING_MESSAGE);
}

View File

@ -833,7 +833,7 @@ public class MiscTools {
boolean error = false, error509 = false, error403 = false;
SmartMegaProxyManager proxy_manager = null;
SmartMegaProxyManager proxy_manager = MainPanel.getProxy_manager();
String current_proxy = null;
@ -904,6 +904,11 @@ public class MiscTools {
}
if (current_proxy != null) {
con.setConnectTimeout(Transference.HTTP_PROXY_CONNECT_TIMEOUT);
con.setReadTimeout(Transference.HTTP_PROXY_READ_TIMEOUT);
}
con.setUseCaches(false);
con.setRequestProperty("User-Agent", MainPanel.DEFAULT_USER_AGENT);

View File

@ -39,19 +39,22 @@ public final class SmartMegaProxyManager {
public synchronized String getFastestProxy() {
Set<String> keys = _proxy_list.keySet();
if (_proxy_list.size() > 0) {
Long current_time = System.currentTimeMillis();
Set<String> keys = _proxy_list.keySet();
for (String k : keys) {
Long current_time = System.currentTimeMillis();
if (_proxy_list.get(k) < current_time) {
for (String k : keys) {
return k;
if (_proxy_list.get(k) < current_time) {
return k;
}
}
}
LOG.log(Level.WARNING, "{0} Smart Proxy Manager: NO PROXYS AVAILABLE!!", new Object[]{Thread.currentThread().getName()});
LOG.log(Level.WARNING, "{0} Smart Proxy Manager: NO PROXYS AVAILABLE!! (Refreshing...)", new Object[]{Thread.currentThread().getName()});
refreshProxyList();

View File

@ -130,7 +130,6 @@ public class StreamChunkDownloader implements Runnable {
if (current_smart_proxy != null) {
con.setConnectTimeout(Transference.HTTP_PROXY_CONNECT_TIMEOUT);
con.setReadTimeout(Transference.HTTP_PROXY_READ_TIMEOUT);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 193 KiB