mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-28 20:40:13 +02:00
1.63
-Lock fix
This commit is contained in:
parent
6766c9fcde
commit
7ab4d9a62c
@ -62,6 +62,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
|||||||
private volatile SpeedMeter _speed_meter = null; //lazy init
|
private volatile SpeedMeter _speed_meter = null; //lazy init
|
||||||
private volatile ProgressMeter _progress_meter = null; //lazy init;
|
private volatile ProgressMeter _progress_meter = null; //lazy init;
|
||||||
private final Object _secure_notify_lock;
|
private final Object _secure_notify_lock;
|
||||||
|
private final Object _workers_lock;
|
||||||
private boolean _notified;
|
private boolean _notified;
|
||||||
private final String _url;
|
private final String _url;
|
||||||
private final String _download_path;
|
private final String _download_path;
|
||||||
@ -121,6 +122,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
|||||||
_slots = slots;
|
_slots = slots;
|
||||||
_restart = restart;
|
_restart = restart;
|
||||||
_secure_notify_lock = new Object();
|
_secure_notify_lock = new Object();
|
||||||
|
_workers_lock = new Object();
|
||||||
_chunkworkers = new ArrayList<>();
|
_chunkworkers = new ArrayList<>();
|
||||||
_partialProgressQueue = new ConcurrentLinkedQueue<>();
|
_partialProgressQueue = new ConcurrentLinkedQueue<>();
|
||||||
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
|
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
|
||||||
@ -317,9 +319,12 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
|||||||
|
|
||||||
getSpeed_meter().secureNotify();
|
getSpeed_meter().secureNotify();
|
||||||
|
|
||||||
for (ChunkDownloader downloader : getChunkworkers()) {
|
synchronized (_workers_lock) {
|
||||||
|
|
||||||
downloader.secureNotify();
|
for (ChunkDownloader downloader : getChunkworkers()) {
|
||||||
|
|
||||||
|
downloader.secureNotify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getView().resume();
|
getView().resume();
|
||||||
@ -1114,7 +1119,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
|||||||
|
|
||||||
getView().stop("Stopping download safely, please wait...");
|
getView().stop("Stopping download safely, please wait...");
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (_workers_lock) {
|
||||||
|
|
||||||
for (ChunkDownloader downloader : _chunkworkers) {
|
for (ChunkDownloader downloader : _chunkworkers) {
|
||||||
|
|
||||||
@ -1122,6 +1127,8 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("stop4");
|
||||||
|
|
||||||
secureNotify();
|
secureNotify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,12 +354,14 @@ public final class DownloadView extends javax.swing.JPanel implements Transferen
|
|||||||
private void stop_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stop_buttonActionPerformed
|
private void stop_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stop_buttonActionPerformed
|
||||||
|
|
||||||
_download.stop();
|
_download.stop();
|
||||||
|
System.out.println("stopped");
|
||||||
|
|
||||||
}//GEN-LAST:event_stop_buttonActionPerformed
|
}//GEN-LAST:event_stop_buttonActionPerformed
|
||||||
|
|
||||||
private void pause_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pause_buttonActionPerformed
|
private void pause_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pause_buttonActionPerformed
|
||||||
|
|
||||||
_download.pause();
|
_download.pause();
|
||||||
|
System.out.println("paused!");
|
||||||
}//GEN-LAST:event_pause_buttonActionPerformed
|
}//GEN-LAST:event_pause_buttonActionPerformed
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,7 +61,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
public final class MainPanel {
|
||||||
|
|
||||||
public static final String VERSION = "1.62";
|
public static final String VERSION = "1.63";
|
||||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||||
public static final int STREAMER_PORT = 1337;
|
public static final int STREAMER_PORT = 1337;
|
||||||
public static final int WATCHDOG_PORT = 1338;
|
public static final int WATCHDOG_PORT = 1338;
|
||||||
|
@ -42,6 +42,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
|||||||
private volatile boolean _exit;
|
private volatile boolean _exit;
|
||||||
private final int _slots;
|
private final int _slots;
|
||||||
private final Object _secure_notify_lock;
|
private final Object _secure_notify_lock;
|
||||||
|
private final Object _workers_lock;
|
||||||
private byte[] _byte_file_key;
|
private byte[] _byte_file_key;
|
||||||
private String _fatal_error;
|
private String _fatal_error;
|
||||||
private volatile long _progress;
|
private volatile long _progress;
|
||||||
@ -97,6 +98,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
|||||||
_restart = restart;
|
_restart = restart;
|
||||||
_completion_handle = null;
|
_completion_handle = null;
|
||||||
_secure_notify_lock = new Object();
|
_secure_notify_lock = new Object();
|
||||||
|
_workers_lock = new Object();
|
||||||
_chunkworkers = new ArrayList<>();
|
_chunkworkers = new ArrayList<>();
|
||||||
_partialProgressQueue = new ConcurrentLinkedQueue<>();
|
_partialProgressQueue = new ConcurrentLinkedQueue<>();
|
||||||
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
|
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
|
||||||
@ -494,9 +496,12 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
|||||||
|
|
||||||
getSpeed_meter().secureNotify();
|
getSpeed_meter().secureNotify();
|
||||||
|
|
||||||
for (ChunkUploader uploader : getChunkworkers()) {
|
synchronized (_workers_lock) {
|
||||||
|
|
||||||
uploader.secureNotify();
|
for (ChunkUploader uploader : getChunkworkers()) {
|
||||||
|
|
||||||
|
uploader.secureNotify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setPaused_workers(0);
|
setPaused_workers(0);
|
||||||
@ -988,7 +993,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
|||||||
|
|
||||||
getView().stop("Stopping upload safely, please wait...");
|
getView().stop("Stopping upload safely, please wait...");
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (_workers_lock) {
|
||||||
|
|
||||||
for (ChunkUploader uploader : _chunkworkers) {
|
for (ChunkUploader uploader : _chunkworkers) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user