Very very (very) old bug bug that blocked uploads/downloads when slots were running out
This commit is contained in:
tonikelope 2023-01-02 17:10:38 +01:00
parent cea6c7b7d0
commit 2120f621c4
6 changed files with 47 additions and 32 deletions

View File

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

View File

@ -496,7 +496,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
@Override
public void checkSlotsAndWorkers() {
if (!isExit()) {
if (!isExit() && !this._finalizing) {
synchronized (_workers_lock) {

View File

@ -67,7 +67,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "7.59";
public static final String VERSION = "7.60";
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;
@ -114,10 +114,10 @@ public final class MainPanel {
if (args.length > 1) {
try {
Logger.getLogger(MainPanel.class.getName()).log(Level.INFO, "{0} Waiting {1} seconds before start...", new Object[]{Thread.currentThread().getName(), args[1]});
if(Long.parseLong(args[1])>=0){
if (Long.parseLong(args[1]) >= 0) {
Thread.sleep(Long.parseLong(args[1]) * 1000);
}else {
} else {
CHECK_RUNNING = false;
}
} catch (InterruptedException ex) {

View File

@ -289,56 +289,71 @@ public final class MainPanelView extends javax.swing.JFrame {
String file_path = f.getParentFile().getAbsolutePath().replace(base_path, "");
LOG.log(Level.INFO, "{0} FILE_PATH -> {1}", new Object[]{Thread.currentThread().getName(), file_path});
try {
String[] dirs = file_path.split("\\" + File.separator);
LOG.log(Level.INFO, "{0} FILE_PATH -> {1}", new Object[]{Thread.currentThread().getName(), file_path});
MegaDirNode current_node = file_paths;
String[] dirs = file_path.split("\\" + File.separator);
String file_parent = current_node.getNode_id();
MegaDirNode current_node = file_paths;
for (String d : dirs) {
String file_parent = current_node.getNode_id();
LOG.log(Level.INFO, "{0} DIR -> {1}", new Object[]{Thread.currentThread().getName(), d});
for (String d : dirs) {
if (!d.isEmpty()) {
LOG.log(Level.INFO, "{0} DIR -> {1}", new Object[]{Thread.currentThread().getName(), d});
if (current_node.getChildren().get(d) != null) {
if (!d.isEmpty()) {
current_node = current_node.getChildren().get(d);
if (current_node.getChildren().get(d) != null) {
file_parent = current_node.getNode_id();
current_node = current_node.getChildren().get(d);
} else {
file_parent = current_node.getNode_id();
res = ma.createDirInsideAnotherSharedDir(d, current_node.getNode_id(), ma.genFolderKey(), i32a2bin(ma.getMaster_key()), parent_node, share_key);
} else {
file_parent = (String) ((Map) ((List) res.get("f")).get(0)).get("h");
res = ma.createDirInsideAnotherSharedDir(d, current_node.getNode_id(), ma.genFolderKey(), i32a2bin(ma.getMaster_key()), parent_node, share_key);
current_node.getChildren().put(d, new MegaDirNode(file_parent));
file_parent = (String) ((Map) ((List) res.get("f")).get(0)).get("h");
current_node = current_node.getChildren().get(d);
current_node.getChildren().put(d, new MegaDirNode(file_parent));
current_node = current_node.getChildren().get(d);
}
}
}
}
while (getMain_panel().getUpload_manager().getTransference_waitstart_queue().size() >= TransferenceManager.MAX_WAIT_QUEUE || getMain_panel().getUpload_manager().getTransference_waitstart_aux_queue().size() >= TransferenceManager.MAX_WAIT_QUEUE) {
while (getMain_panel().getUpload_manager().getTransference_waitstart_queue().size() >= TransferenceManager.MAX_WAIT_QUEUE || getMain_panel().getUpload_manager().getTransference_waitstart_aux_queue().size() >= TransferenceManager.MAX_WAIT_QUEUE) {
synchronized (getMain_panel().getUpload_manager().getWait_queue_lock()) {
getMain_panel().getUpload_manager().getWait_queue_lock().wait(1000);
synchronized (getMain_panel().getUpload_manager().getWait_queue_lock()) {
getMain_panel().getUpload_manager().getWait_queue_lock().wait(1000);
}
}
}
if (!getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().isEmpty()) {
if (!getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().isEmpty()) {
Upload upload = new Upload(getMain_panel(), ma, f.getAbsolutePath(), file_parent, null, null, parent_node, share_key, folder_link, dialog.getPriority_checkbox().isSelected());
Upload upload = new Upload(getMain_panel(), ma, f.getAbsolutePath(), file_parent, null, null, parent_node, share_key, folder_link, dialog.getPriority_checkbox().isSelected());
getMain_panel().getUpload_manager().getTransference_provision_queue().add(upload);
getMain_panel().getUpload_manager().getTransference_provision_queue().add(upload);
getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().remove(f);
getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().remove(f);
getMain_panel().getUpload_manager().secureNotify();
getMain_panel().getUpload_manager().secureNotify();
}
} catch (Exception ex) {
if (!getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().isEmpty()) {
getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().remove(f);
getMain_panel().getUpload_manager().secureNotify();
}
LOG.log(SEVERE, null, ex);
}
}

View File

@ -570,7 +570,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
@Override
public void checkSlotsAndWorkers() {
if (!isExit()) {
if (!isExit() && !this._finalizing) {
synchronized (_workers_lock) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 181 KiB