mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-29 14:14:37 +02:00
8.16
Upload logs in folder SmartProxy tunning
This commit is contained in:
parent
3c327bc2d1
commit
8ce5b11f85
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>8.15</version>
|
||||
<version>8.16</version>
|
||||
<packaging>jar</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -194,7 +194,15 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
if (_current_smart_proxy != null && chunk_error) {
|
||||
|
||||
proxy_manager.blockProxy(_current_smart_proxy, timeout ? "TIMEOUT!" : "HTTP " + String.valueOf(http_error));
|
||||
if (!timeout && http_error != 429) {
|
||||
proxy_manager.blockProxy(_current_smart_proxy, timeout ? "TIMEOUT!" : "HTTP " + String.valueOf(http_error));
|
||||
} else if (timeout) {
|
||||
_excluded_proxy_list.add(_current_smart_proxy);
|
||||
LOG.log(Level.WARNING, "{0} Worker [{1}] PROXY {2} TIMEOUT", new Object[]{Thread.currentThread().getName(), _id, _current_smart_proxy});
|
||||
} else {
|
||||
_excluded_proxy_list.add(_current_smart_proxy);
|
||||
LOG.log(Level.WARNING, "{0} Worker [{1}] PROXY {2} TOO MANY CONNECTIONS", new Object[]{Thread.currentThread().getName(), _id, _current_smart_proxy});
|
||||
}
|
||||
|
||||
String[] smart_proxy = proxy_manager.getProxy(_excluded_proxy_list);
|
||||
|
||||
@ -274,6 +282,8 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
timeout = false;
|
||||
|
||||
http_error = 0;
|
||||
|
||||
File tmp_chunk_file = null, chunk_file = null;
|
||||
|
||||
LOG.log(Level.INFO, "{0} Worker [{1}] is downloading chunk [{2}]! {3}", new Object[]{Thread.currentThread().getName(), _id, chunk_id, _download.getFile_name()});
|
||||
|
@ -70,7 +70,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "8.15";
|
||||
public static final String VERSION = "8.16";
|
||||
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
@ -256,6 +256,8 @@ public final class MainPanel {
|
||||
|
||||
_resume_downloads = false;
|
||||
|
||||
MiscTools.createUploadLogDir();
|
||||
|
||||
try {
|
||||
|
||||
setupSqliteTables();
|
||||
|
@ -276,7 +276,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
if (dialog.getUpload_log_checkbox().isSelected()) {
|
||||
|
||||
File upload_log = new File(MainPanel.MEGABASTERD_HOME_DIR + "/megabasterd_upload_" + parent_node + ".log");
|
||||
File upload_log = new File(MiscTools.UPLOAD_LOGS_DIR + "/megabasterd_upload_" + parent_node + ".log");
|
||||
upload_log.createNewFile();
|
||||
|
||||
FileWriter fr;
|
||||
|
@ -119,6 +119,8 @@ public class MiscTools {
|
||||
public static final int EXP_BACKOFF_MAX_WAIT_TIME = 8;
|
||||
public static final Object PASS_LOCK = new Object();
|
||||
public static final int HTTP_TIMEOUT = 30;
|
||||
public static final String UPLOAD_LOGS_DIR = System.getProperty("user.home") + File.separator + "MEGABASTERD_UPLOAD_LOGS";
|
||||
|
||||
private static final Comparator<DefaultMutableTreeNode> TREE_NODE_COMPARATOR = (DefaultMutableTreeNode a, DefaultMutableTreeNode b) -> {
|
||||
if (a.isLeaf() && !b.isLeaf()) {
|
||||
return 1;
|
||||
@ -160,6 +162,27 @@ public class MiscTools {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void createUploadLogDir() {
|
||||
|
||||
if (!Files.exists(Paths.get(UPLOAD_LOGS_DIR))) {
|
||||
try {
|
||||
Files.createDirectory(Paths.get(UPLOAD_LOGS_DIR));
|
||||
|
||||
File dir = new File(System.getProperty("user.home"));
|
||||
|
||||
for (File file : dir.listFiles()) {
|
||||
if (!file.isDirectory() && file.getName().startsWith("megabasterd_upload_")) {
|
||||
Files.move(file.toPath(), Paths.get(UPLOAD_LOGS_DIR + File.separator + file.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void purgeFolderCache() {
|
||||
File directory = new File(System.getProperty("java.io.tmpdir"));
|
||||
|
||||
|
@ -992,7 +992,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
synchronized (this.getMain_panel().getUpload_manager().getLog_file_lock()) {
|
||||
|
||||
File upload_log = new File(MainPanel.MEGABASTERD_HOME_DIR + "/megabasterd_upload_" + _root_node + ".log");
|
||||
File upload_log = new File(MiscTools.UPLOAD_LOGS_DIR + "/megabasterd_upload_" + _root_node + ".log");
|
||||
|
||||
if (upload_log.exists()) {
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 205 KiB |
Loading…
x
Reference in New Issue
Block a user