From 7d376801e8fd5b8274a7386006b55b5dc5767f77 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Mon, 30 Sep 2013 15:29:03 -0700 Subject: #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. --- src/github/daneren2005/dsub/service/StreamProxy.java | 6 ++++++ 1 file changed, 6 insertions(+) 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"); } -- cgit v1.2.3