add property pass-through support, directly check on Snark's completion
This commit is contained in:
@@ -98,6 +98,15 @@ public class GetdownApplet extends JApplet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pass through properties parameter.
|
||||||
|
String[] properties = getParameter("properties").split(" ");
|
||||||
|
for (String property : properties) {
|
||||||
|
String key = property.substring(property.indexOf("-D") + 2,
|
||||||
|
property.indexOf("="));
|
||||||
|
String value = property.substring(property.indexOf("=") + 1);
|
||||||
|
System.setProperty(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
// when run from an applet, we install
|
// when run from an applet, we install
|
||||||
String root;
|
String root;
|
||||||
if (RunAnywhere.isWindows()) {
|
if (RunAnywhere.isWindows()) {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class TorrentDownloader extends Downloader
|
|||||||
// Override the start time, since Snark allocates storage prior to
|
// Override the start time, since Snark allocates storage prior to
|
||||||
// doing any downloading
|
// doing any downloading
|
||||||
_start = System.currentTimeMillis();
|
_start = System.currentTimeMillis();
|
||||||
while (_currentSize != snark.meta.getTotalLength()) {
|
while (!snark.coordinator.completed()) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if ((now - _lastUpdate) >= UPDATE_DELAY) {
|
if ((now - _lastUpdate) >= UPDATE_DELAY) {
|
||||||
_currentSize = snark.coordinator.getDownloaded();
|
_currentSize = snark.coordinator.getDownloaded();
|
||||||
@@ -106,6 +106,10 @@ public class TorrentDownloader extends Downloader
|
|||||||
}
|
}
|
||||||
updateObserver();
|
updateObserver();
|
||||||
}
|
}
|
||||||
|
// Manually set completion, just to be extra-safe.
|
||||||
|
_currentSize = _totalSize;
|
||||||
|
updateObserver();
|
||||||
|
|
||||||
if (snarkStopper != null) {
|
if (snarkStopper != null) {
|
||||||
snarkStopper.run();
|
snarkStopper.run();
|
||||||
Runtime.getRuntime().removeShutdownHook(snarkStopper);
|
Runtime.getRuntime().removeShutdownHook(snarkStopper);
|
||||||
|
|||||||
Reference in New Issue
Block a user