Trying to fix -> https://github.com/tonikelope/megabasterd/issues/282
This commit is contained in:
tonikelope 2021-01-04 13:48:19 +01:00
parent 71427a2762
commit 5847ff5cca
15 changed files with 70 additions and 66 deletions

View File

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

View File

@ -97,7 +97,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
_exit = true;
LOG.log(Level.SEVERE, ex.getMessage());

View File

@ -72,7 +72,7 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
_exit = true;
LOG.log(Level.SEVERE, ex.getMessage());

View File

@ -113,7 +113,7 @@ public class ChunkWriterManager implements Runnable, SecureSingleThreadNotifiabl
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
_exit = true;
LOG.log(Level.SEVERE, ex.getMessage());
@ -153,20 +153,23 @@ public class ChunkWriterManager implements Runnable, SecureSingleThreadNotifiabl
@Override
public void run() {
try {
LOG.log(Level.INFO, "{0} ChunkWriterManager: let's do some work! {1}", new Object[]{Thread.currentThread().getName(), _download.getFile_name()});
LOG.log(Level.INFO, "{0} ChunkWriterManager LAST CHUNK WRITTEN -> [{1}] {2} {3}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written, _bytes_written, _download.getFile_name()});
boolean download_finished = false;
if (_file_size > 0) {
while (!_exit && (!_download.isStopped() || !_download.getChunkworkers().isEmpty()) && _bytes_written < _file_size) {
boolean chunk_io_error;
do {
chunk_io_error = false;
try {
File chunk_file = new File(getChunks_dir() + "/" + new File(_download.getFile_name()).getName() + ".chunk" + String.valueOf(_last_chunk_id_written + 1));
while (chunk_file.exists() && chunk_file.canRead()) {
while (chunk_file.exists() && chunk_file.canRead() && chunk_file.length() > 0) {
if (!download_finished && _download.getProgress() == _file_size) {
@ -197,14 +200,21 @@ public class ChunkWriterManager implements Runnable, SecureSingleThreadNotifiabl
_bytes_written += chunk_file.length();
LOG.log(Level.INFO, "{0} ChunkWriterManager has written to disk chunk [{1}] {2} {3} {4}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written + 1, _bytes_written, _download.calculateLastWrittenChunk(_bytes_written), _download.getFile_name()});
_last_chunk_id_written++;
LOG.log(Level.INFO, "{0} ChunkWriterManager has written to disk chunk [{1}] {2} {3} {4}...", new Object[]{Thread.currentThread().getName(), _last_chunk_id_written, _bytes_written, _download.calculateLastWrittenChunk(_bytes_written), _download.getFile_name()});
chunk_file.delete();
chunk_file = new File(getChunks_dir() + "/" + new File(_download.getFile_name()).getName() + ".chunk" + String.valueOf(_last_chunk_id_written + 1));
}
} catch (IOException ex) {
chunk_io_error = true;
LOG.log(Level.WARNING, ex.getMessage());
MiscTools.pausar(1000);
}
} while (chunk_io_error);
if (!_exit && (!_download.isStopped() || !_download.getChunkworkers().isEmpty()) && _bytes_written < _file_size) {
@ -220,12 +230,6 @@ public class ChunkWriterManager implements Runnable, SecureSingleThreadNotifiabl
}
}
} catch (IOException ex) {
LOG.log(Level.SEVERE, ex.getMessage());
_download.stopDownloader(ex.getMessage());
}
_exit = true;
_download.secureNotify();

View File

@ -81,7 +81,7 @@ public class ClipboardSpy implements Runnable, ClipboardOwner, SecureSingleThrea
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
LOG.log(SEVERE, ex.getMessage());
}

View File

@ -1621,7 +1621,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
_exit = true;
LOG.log(SEVERE, null, ex);

View File

@ -87,7 +87,7 @@ public class KissVideoStreamServer implements HttpHandler, SecureSingleThreadNot
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
LOG.log(SEVERE, null, ex);
}

View File

@ -60,7 +60,7 @@ import javax.swing.UIManager;
*/
public final class MainPanel {
public static final String VERSION = "7.37";
public static final String VERSION = "7.38";
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;

View File

@ -47,7 +47,7 @@ public class ProgressMeter implements Runnable, SecureSingleThreadNotifiable {
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
_exit = true;
LOG.log(SEVERE, null, ex);

View File

@ -170,7 +170,7 @@ public class StreamChunkManager implements Runnable, SecureMultiThreadNotifiable
while (!_notified_threads.get(current_thread)) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
LOG.log(Level.SEVERE, ex.getMessage());
}

View File

@ -96,7 +96,7 @@ public class StreamThrottlerSupervisor implements Runnable, SecureMultiThreadNot
while (!_notified_threads.get(current_thread)) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
LOG.log(Level.SEVERE, ex.getMessage());
}

View File

@ -212,7 +212,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
LOG.log(Level.SEVERE, ex.getMessage());
}

View File

@ -360,7 +360,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
_exit = true;
LOG.log(Level.SEVERE, ex.getMessage());

View File

@ -49,7 +49,7 @@ public class UploadMACGenerator implements Runnable, SecureSingleThreadNotifiabl
while (!_notified) {
try {
_secure_notify_lock.wait();
_secure_notify_lock.wait(1000);
} catch (InterruptedException ex) {
_exit = true;
LOG.log(Level.SEVERE, ex.getMessage());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 180 KiB