6.15
-SmartProxy tunning
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.14</version>
|
<version>6.15</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -2,6 +2,7 @@ package com.tonikelope.megabasterd;
|
|||||||
|
|
||||||
import static com.tonikelope.megabasterd.MainPanel.*;
|
import static com.tonikelope.megabasterd.MainPanel.*;
|
||||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
import static com.tonikelope.megabasterd.MiscTools.*;
|
||||||
|
import java.awt.Color;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,7 +21,7 @@ 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.1;
|
public static final double SLOW_PROXY_PERC = 0.3;
|
||||||
private final int _id;
|
private final int _id;
|
||||||
private final Download _download;
|
private final Download _download;
|
||||||
private volatile boolean _exit;
|
private volatile boolean _exit;
|
||||||
@ -99,7 +100,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
int http_error = 0, conta_error = 0, http_status = -1;
|
int http_error = 0, http_status = -1;
|
||||||
|
|
||||||
boolean timeout = false, chunk_error = false, slow_proxy = false;
|
boolean timeout = false, chunk_error = false, slow_proxy = false;
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
proxy_manager.blockProxy(current_smart_proxy);
|
proxy_manager.blockProxy(current_smart_proxy);
|
||||||
|
|
||||||
Logger.getLogger(MiscTools.class.getName()).log(Level.WARNING, "{0}: excluding proxy -> {1}", new Object[]{Thread.currentThread().getName(), current_smart_proxy});
|
Logger.getLogger(MiscTools.class.getName()).log(Level.WARNING, "{0}: worker {1} excluding proxy -> {2}", new Object[]{Thread.currentThread().getName(), _id, current_smart_proxy});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
con = (HttpURLConnection) url.openConnection(proxy);
|
con = (HttpURLConnection) url.openConnection(proxy);
|
||||||
|
|
||||||
getDownload().getMain_panel().getView().setSmartProxy(true);
|
getDownload().getView().getSpeed_label().setForeground(new Color(255, 102, 0));
|
||||||
|
|
||||||
getDownload().enableProxyTurboMode();
|
getDownload().enableProxyTurboMode();
|
||||||
|
|
||||||
@ -157,8 +158,6 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
URL url = new URL(chunk_url);
|
URL url = new URL(chunk_url);
|
||||||
|
|
||||||
con = (HttpURLConnection) url.openConnection();
|
con = (HttpURLConnection) url.openConnection();
|
||||||
|
|
||||||
getDownload().getMain_panel().getView().setSmartProxy(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -180,8 +179,6 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_smart_proxy = null;
|
current_smart_proxy = null;
|
||||||
|
|
||||||
getDownload().getMain_panel().getView().setSmartProxy(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_smart_proxy != null) {
|
if (current_smart_proxy != null) {
|
||||||
@ -196,12 +193,6 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
con.setRequestProperty("User-Agent", MainPanel.DEFAULT_USER_AGENT);
|
con.setRequestProperty("User-Agent", MainPanel.DEFAULT_USER_AGENT);
|
||||||
|
|
||||||
if (getDownload().isError509()) {
|
|
||||||
getDownload().getView().set509Error(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
http_error = 0;
|
|
||||||
|
|
||||||
long chunk_reads = 0;
|
long chunk_reads = 0;
|
||||||
|
|
||||||
chunk_error = true;
|
chunk_error = true;
|
||||||
@ -222,12 +213,12 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
if (http_status != 200) {
|
if (http_status != 200) {
|
||||||
|
|
||||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Failed : HTTP error code : {1}", new Object[]{Thread.currentThread().getName(), http_status});
|
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Worker [{1}] Failed chunk download : HTTP error code : {2}", new Object[]{Thread.currentThread().getName(), _id, http_status});
|
||||||
|
|
||||||
http_error = http_status;
|
http_error = http_status;
|
||||||
|
|
||||||
if (http_error == 509 && MainPanel.isUse_smart_proxy()) {
|
if (http_error == 509 && MainPanel.isUse_smart_proxy()) {
|
||||||
getDownload().getView().set509Error(true);
|
getDownload().getView().set509Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -248,7 +239,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
byte[] buffer = new byte[DEFAULT_BYTE_BUFFER_SIZE];
|
byte[] buffer = new byte[DEFAULT_BYTE_BUFFER_SIZE];
|
||||||
|
|
||||||
while (!_exit && !slow_proxy && !_download.isStopped() && !_download.getChunkmanager().isExit() && chunk_reads < chunk_size && (reads = is.read(buffer, 0, Math.min((int) (chunk_size - chunk_reads), buffer.length))) != -1) {
|
while (!_exit && !_download.isStopped() && !_download.getChunkmanager().isExit() && chunk_reads < chunk_size && (reads = is.read(buffer, 0, Math.min((int) (chunk_size - chunk_reads), buffer.length))) != -1) {
|
||||||
|
|
||||||
tmp_chunk_file_os.write(buffer, 0, reads);
|
tmp_chunk_file_os.write(buffer, 0, reads);
|
||||||
|
|
||||||
@ -270,22 +261,6 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_smart_proxy != null) {
|
|
||||||
|
|
||||||
long avg_chunk_speed = _download.getMain_panel().getGlobal_dl_speed().getAvg_chunk_speed();
|
|
||||||
|
|
||||||
if (avg_chunk_speed != -1) {
|
|
||||||
//Proxy speed benchmark
|
|
||||||
long chunk_speed = Math.round(chunk_reads / (((double) (System.currentTimeMillis() - init_chunk_time - paused)) / 1000));
|
|
||||||
|
|
||||||
if (chunk_speed < Math.round(avg_chunk_speed * SLOW_PROXY_PERC)) {
|
|
||||||
|
|
||||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Worker WARNING -> PROXY {1} CHUNK DOWNLOAD SPEED: {2}/s IS VERY SLOW (average is {3}/s)", new Object[]{_id, current_smart_proxy, formatBytes(chunk_speed), formatBytes(avg_chunk_speed)});
|
|
||||||
|
|
||||||
slow_proxy = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
finish_chunk_time = System.currentTimeMillis();
|
finish_chunk_time = System.currentTimeMillis();
|
||||||
@ -319,8 +294,6 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
tmp_chunk_file.renameTo(chunk_file);
|
tmp_chunk_file.renameTo(chunk_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
conta_error = 0;
|
|
||||||
|
|
||||||
chunk_error = false;
|
chunk_error = false;
|
||||||
|
|
||||||
http_error = 0;
|
http_error = 0;
|
||||||
@ -329,8 +302,21 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
|
|
||||||
//Update average chunk download speed using SmartProxy
|
//Update average chunk download speed using SmartProxy
|
||||||
long chunk_speed = Math.round(chunk_size / (((double) (finish_chunk_time - init_chunk_time - paused)) / 1000));
|
long chunk_speed = Math.round(chunk_size / (((double) (finish_chunk_time - init_chunk_time - paused)) / 1000));
|
||||||
|
|
||||||
_download.getMain_panel().getGlobal_dl_speed().update_avg_chunk_speed(chunk_speed);
|
_download.getMain_panel().getGlobal_dl_speed().update_avg_chunk_speed(chunk_speed);
|
||||||
|
|
||||||
|
long avg_chunk_speed = _download.getMain_panel().getGlobal_dl_speed().getAvg_chunk_speed();
|
||||||
|
|
||||||
|
if (avg_chunk_speed != -1) {
|
||||||
|
//Proxy speed benchmark
|
||||||
|
|
||||||
|
if (chunk_speed < Math.round(avg_chunk_speed * SLOW_PROXY_PERC)) {
|
||||||
|
|
||||||
|
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Worker [{1}] WARNING -> PROXY {2} CHUNK DOWNLOAD SPEED: {3}/s SEEMS TO BE SLOW (average is {4}/s)", new Object[]{Thread.currentThread().getName(), _id, current_smart_proxy, formatBytes(chunk_speed), formatBytes(avg_chunk_speed)});
|
||||||
|
|
||||||
|
slow_proxy = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_download.getChunkmanager().secureNotify();
|
_download.getChunkmanager().secureNotify();
|
||||||
@ -366,13 +352,16 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
|||||||
_download.getProgress_meter().secureNotify();
|
_download.getProgress_meter().secureNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_exit && !_download.isStopped() && !timeout && (http_error != 509 || !MainPanel.isUse_smart_proxy()) && http_error != 403) {
|
if (!_exit && !_download.isStopped() && !timeout && (http_error != 509 || current_smart_proxy != null) && http_error != 403) {
|
||||||
|
|
||||||
_error_wait = true;
|
_error_wait = true;
|
||||||
|
|
||||||
_download.getView().updateSlotsStatus();
|
_download.getView().updateSlotsStatus();
|
||||||
|
|
||||||
Thread.sleep(getWaitTimeExpBackOff(++conta_error) * 1000);
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException excep) {
|
||||||
|
}
|
||||||
|
|
||||||
_error_wait = false;
|
_error_wait = false;
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import static com.tonikelope.megabasterd.CryptTools.genDecrypter;
|
|||||||
import static com.tonikelope.megabasterd.CryptTools.initMEGALinkKey;
|
import static com.tonikelope.megabasterd.CryptTools.initMEGALinkKey;
|
||||||
import static com.tonikelope.megabasterd.CryptTools.initMEGALinkKeyIV;
|
import static com.tonikelope.megabasterd.CryptTools.initMEGALinkKeyIV;
|
||||||
import static com.tonikelope.megabasterd.MainPanel.*;
|
import static com.tonikelope.megabasterd.MainPanel.*;
|
||||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
@ -41,8 +40,6 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
byte[] byte_file_key = initMEGALinkKey(getDownload().getFile_key());
|
byte[] byte_file_key = initMEGALinkKey(getDownload().getFile_key());
|
||||||
byte[] byte_iv = initMEGALinkKeyIV(getDownload().getFile_key());
|
byte[] byte_iv = initMEGALinkKeyIV(getDownload().getFile_key());
|
||||||
|
|
||||||
getDownload().getView().set509Error(false);
|
|
||||||
|
|
||||||
CipherInputStream cis = null;
|
CipherInputStream cis = null;
|
||||||
|
|
||||||
while (!isExit() && !getDownload().isStopped()) {
|
while (!isExit() && !getDownload().isStopped()) {
|
||||||
@ -99,10 +96,6 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
|
|
||||||
http_error = 0;
|
http_error = 0;
|
||||||
|
|
||||||
if (getDownload().isError509()) {
|
|
||||||
getDownload().getView().set509Error(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (http_status != 200) {
|
if (http_status != 200) {
|
||||||
|
|
||||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Failed : HTTP error code : {1}", new Object[]{Thread.currentThread().getName(), http_status});
|
Logger.getLogger(getClass().getName()).log(Level.INFO, "{0} Failed : HTTP error code : {1}", new Object[]{Thread.currentThread().getName(), http_status});
|
||||||
@ -111,7 +104,7 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
|
|
||||||
if (http_error == 509) {
|
if (http_error == 509) {
|
||||||
|
|
||||||
getDownload().getView().set509Error(true);
|
getDownload().getView().set509Error();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +116,10 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
|
|
||||||
setError_wait(true);
|
setError_wait(true);
|
||||||
|
|
||||||
Thread.sleep(getWaitTimeExpBackOff(conta_error) * 1000);
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException excep) {
|
||||||
|
}
|
||||||
|
|
||||||
setError_wait(false);
|
setError_wait(false);
|
||||||
}
|
}
|
||||||
@ -152,13 +148,6 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
|
|
||||||
secureWait();
|
secureWait();
|
||||||
|
|
||||||
} else if (!getDownload().isPaused() && getDownload().getMain_panel().getDownload_manager().isPaused_all()) {
|
|
||||||
|
|
||||||
getDownload().pause();
|
|
||||||
|
|
||||||
getDownload().pause_worker_mono();
|
|
||||||
|
|
||||||
secureWait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -178,7 +167,7 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException | InterruptedException ex) {
|
} catch (IOException ex) {
|
||||||
|
|
||||||
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
|
||||||
|
|
||||||
@ -198,7 +187,10 @@ public class ChunkDownloaderMono extends ChunkDownloader {
|
|||||||
|
|
||||||
setError_wait(true);
|
setError_wait(true);
|
||||||
|
|
||||||
Thread.sleep(getWaitTimeExpBackOff(++conta_error) * 1000);
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException excep) {
|
||||||
|
}
|
||||||
|
|
||||||
setError_wait(false);
|
setError_wait(false);
|
||||||
}
|
}
|
||||||
|
@ -621,11 +621,16 @@ public final class DownloadView extends javax.swing.JPanel implements Transferen
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set509Error(boolean error) {
|
public void set509Error() {
|
||||||
|
|
||||||
_download.setError509(error);
|
if (!_download.isError509()) {
|
||||||
|
|
||||||
|
_download.setError509(true);
|
||||||
|
|
||||||
|
speed_label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-error-40.png")));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
speed_label.setIcon(error ? new javax.swing.ImageIcon(getClass().getResource("/images/icons8-error-40.png")) : null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
@ -50,7 +50,7 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "6.14";
|
public static final String VERSION = "6.15";
|
||||||
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;
|
||||||
@ -61,7 +61,7 @@ public final class MainPanel {
|
|||||||
public static Font DEFAULT_FONT = createAndRegisterFont("/fonts/Kalam-Light.ttf");
|
public static Font DEFAULT_FONT = createAndRegisterFont("/fonts/Kalam-Light.ttf");
|
||||||
public static final float ZOOM_FACTOR = 1.0f;
|
public static final float ZOOM_FACTOR = 1.0f;
|
||||||
public static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0";
|
public static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0";
|
||||||
public static final String ICON_FILE = "/images/mbasterd_32.png";
|
public static final String ICON_FILE = "/images/pica_roja_big.png";
|
||||||
public static final ExecutorService THREAD_POOL = newCachedThreadPool();
|
public static final ExecutorService THREAD_POOL = newCachedThreadPool();
|
||||||
private static Boolean _app_image;
|
private static Boolean _app_image;
|
||||||
private static String _proxy_host;
|
private static String _proxy_host;
|
||||||
|
@ -122,9 +122,6 @@
|
|||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||||
<Font name="Dialog" size="18" style="0"/>
|
<Font name="Dialog" size="18" style="0"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/images/mbasterd_32.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" value="Hide to tray"/>
|
<Property name="text" type="java.lang.String" value="Hide to tray"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
|
@ -199,34 +199,6 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSmartProxy(boolean enabled) {
|
|
||||||
|
|
||||||
if (enabled) {
|
|
||||||
_smart_proxy_threads.put(Thread.currentThread(), true);
|
|
||||||
} else {
|
|
||||||
_smart_proxy_threads.remove(Thread.currentThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_main_panel.isLimit_download_speed()) {
|
|
||||||
|
|
||||||
swingInvoke(
|
|
||||||
new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
if (_smart_proxy_threads.isEmpty()) {
|
|
||||||
getGlobal_speed_down_label().setForeground(new Color(0, 128, 255));
|
|
||||||
} else {
|
|
||||||
getGlobal_speed_down_label().setForeground(new Color(255, 102, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public MainPanelView(MainPanel main_panel) {
|
public MainPanelView(MainPanel main_panel) {
|
||||||
|
|
||||||
_main_panel = main_panel;
|
_main_panel = main_panel;
|
||||||
@ -553,7 +525,6 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
file_menu.add(jSeparator2);
|
file_menu.add(jSeparator2);
|
||||||
|
|
||||||
hide_tray_menu.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
|
hide_tray_menu.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
|
||||||
hide_tray_menu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/mbasterd_32.png"))); // NOI18N
|
|
||||||
hide_tray_menu.setText("Hide to tray");
|
hide_tray_menu.setText("Hide to tray");
|
||||||
hide_tray_menu.addActionListener(new java.awt.event.ActionListener() {
|
hide_tray_menu.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
@ -19,7 +19,7 @@ import java.util.logging.Logger;
|
|||||||
public final class SmartMegaProxyManager {
|
public final class SmartMegaProxyManager {
|
||||||
|
|
||||||
public static String DEFAULT_SMART_PROXY_URL = "https://raw.githubusercontent.com/tonikelope/megabasterd/proxy_list/proxy_list.txt";
|
public static String DEFAULT_SMART_PROXY_URL = "https://raw.githubusercontent.com/tonikelope/megabasterd/proxy_list/proxy_list.txt";
|
||||||
public static final int BLOCK_TIME = 300;
|
public static final int BLOCK_TIME = 60;
|
||||||
private volatile String _proxy_list_url;
|
private volatile String _proxy_list_url;
|
||||||
private final LinkedHashMap<String, Long> _proxy_list;
|
private final LinkedHashMap<String, Long> _proxy_list;
|
||||||
private final MainPanel _main_panel;
|
private final MainPanel _main_panel;
|
||||||
|
@ -55,20 +55,23 @@ public final class SpeedMeter implements Runnable {
|
|||||||
|
|
||||||
public void update_avg_chunk_speed(long speed) {
|
public void update_avg_chunk_speed(long speed) {
|
||||||
|
|
||||||
synchronized (this._chunk_speed_queue) {
|
synchronized (_chunk_speed_queue) {
|
||||||
|
|
||||||
this._chunk_speed_queue.add(speed);
|
this._chunk_speed_queue.add(speed);
|
||||||
|
|
||||||
long acumulador = 0;
|
if (_chunk_speed_queue.size() == _chunk_speed_queue.maxSize()) {
|
||||||
|
|
||||||
Iterator i = this._chunk_speed_queue.iterator();
|
long acumulador = 0;
|
||||||
|
|
||||||
while (i.hasNext()) {
|
Iterator i = _chunk_speed_queue.iterator();
|
||||||
|
|
||||||
acumulador += (long) i.next();
|
while (i.hasNext()) {
|
||||||
|
|
||||||
|
acumulador += (long) i.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
_avg_chunk_speed = Math.round(((double) acumulador) / _chunk_speed_queue.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
this._avg_chunk_speed = Math.round(((double) acumulador) / this._chunk_speed_queue.size());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 841 B |
Before Width: | Height: | Size: 195 KiB After Width: | Height: | Size: 208 KiB |
Before Width: | Height: | Size: 52 KiB |