From 14c02da411a9f885a226c38c4b26975f604e39d8 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Thu, 3 Oct 2013 14:59:16 -0700 Subject: Revert last commit --- src/github/daneren2005/dsub/service/StreamProxy.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/github/daneren2005/dsub/service/StreamProxy.java b/src/github/daneren2005/dsub/service/StreamProxy.java index 57235030..3fe1dc17 100644 --- a/src/github/daneren2005/dsub/service/StreamProxy.java +++ b/src/github/daneren2005/dsub/service/StreamProxy.java @@ -165,9 +165,6 @@ public class StreamProxy implements Runnable { return false; } - // Make sure to have file lock - downloadFile.setPlaying(true); - // Use either partial or complete if downloading finished while StreamProxy was idle file = downloadFile.isCompleteFileAvailable() ? downloadFile.getCompleteFile() : downloadFile.getPartialFile(); @@ -204,6 +201,9 @@ public class StreamProxy implements Runnable { output.write(headers.getBytes()); if(!downloadFile.isWorkDone()) { + // Make sure to have file lock + downloadFile.setPlaying(true); + // Loop as long as there's stuff to send while (isRunning && !client.isClosed()) { @@ -240,6 +240,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"); } @@ -258,9 +261,6 @@ public class StreamProxy implements Runnable { output.close(); } client.close(); - - // Release file lock, use of stream proxy means nothing else is using it - downloadFile.setPlaying(false); } catch (IOException e) { Log.e(TAG, "IOException while cleaning up streaming task:"); -- cgit v1.2.3