aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-09-30 15:29:03 -0700
committerdaneren2005 <daneren2005@gmail.com>2013-09-30 15:29:03 -0700
commit7d376801e8fd5b8274a7386006b55b5dc5767f77 (patch)
tree7c03aaa36d53e33c6ad63fd30545bfa087276fdd /src
parentae6544112e357c3d1ff9a68ca0e4c8a55c9afcad (diff)
downloaddsub-7d376801e8fd5b8274a7386006b55b5dc5767f77.tar.gz
dsub-7d376801e8fd5b8274a7386006b55b5dc5767f77.tar.bz2
dsub-7d376801e8fd5b8274a7386006b55b5dc5767f77.zip
#158 Once initial request is done, allow downloadFile to rename .partial
StreamProxy does not handle the partial requests at this point anyways, so it doesn't allow it to get into any worse of a state.
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/StreamProxy.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/service/StreamProxy.java b/src/github/daneren2005/dsub/service/StreamProxy.java
index 24c1b201..76d8382c 100644
--- a/src/github/daneren2005/dsub/service/StreamProxy.java
+++ b/src/github/daneren2005/dsub/service/StreamProxy.java
@@ -183,6 +183,9 @@ public class StreamProxy implements Runnable {
output.write(headers.getBytes());
if(!downloadFile.isWorkDone()) {
+ // Make sure have file lock
+ downloadFile.setPlaying(true);
+
// Loop as long as there's stuff to send
while (isRunning && !client.isClosed()) {
@@ -220,6 +223,9 @@ public class StreamProxy implements Runnable {
Thread.sleep(1000);
}
}
+
+ // Release file lock, use of stream proxy means nothing else is using it
+ downloadFile.setPlaying(false);
} else {
Log.w(TAG, "Requesting data for completely downloaded file");
}