From b1368454eaa75d734b15793b218f6fbb78e65f5b Mon Sep 17 00:00:00 2001 From: waker Date: Mon, 14 Feb 2011 20:05:51 +0100 Subject: fixed vfs_curl stream status after handling abort signal --- plugins/vfs_curl/vfs_curl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'plugins/vfs_curl') diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c index 76598ed8..f9534299 100644 --- a/plugins/vfs_curl/vfs_curl.c +++ b/plugins/vfs_curl/vfs_curl.c @@ -626,10 +626,12 @@ http_thread_func (void *ctx) { continue; } if (fp->status != STATUS_SEEK) { + trace ("vfs_curl: break loop\n"); deadbeef->mutex_unlock (fp->mutex); break; } else { + trace ("vfs_curl: restart loop\n"); fp->skipbytes = 0; fp->status = STATUS_INITIAL; trace ("seeking to %d\n", fp->pos); @@ -657,12 +659,13 @@ http_thread_func (void *ctx) { deadbeef->mutex_lock (fp->mutex); if (fp->status == STATUS_ABORTED) { -// http_destroy (fp); - return; + trace ("vfs_curl: thread ended due to abort signal\n"); + } + else { + trace ("vfs_curl: thread ended normally\n"); } fp->status = STATUS_FINISHED; deadbeef->mutex_unlock (fp->mutex); - // fp->tid = 0; } static void @@ -729,7 +732,7 @@ http_read (void *ptr, size_t size, size_t nmemb, DB_FILE *stream) { { // wait until data is available while ((fp->remaining == 0 || fp->skipbytes > 0) && fp->status != STATUS_FINISHED) { -// trace ("vfs_curl: readwait..\n"); + trace ("vfs_curl: readwait, status: %d..\n", fp->status); deadbeef->mutex_lock (fp->mutex); if (fp->status == STATUS_READING) { struct timeval tm; -- cgit v1.2.3