changeset 945:4f7a55282201 trunk

[svn] - back out r2016,2018.
author nenolod
date Thu, 12 Apr 2007 12:57:45 -0700
parents fe18e45e6660
children 2d06a4e9b032
files ChangeLog src/curl/curl.c
diffstat 2 files changed, 10 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 12 12:33:04 2007 -0700
+++ b/ChangeLog	Thu Apr 12 12:57:45 2007 -0700
@@ -1,3 +1,11 @@
+2007-04-12 19:33:04 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [2018]
+  - protect some functions with a mutex.
+  
+  trunk/src/curl/curl.c |   26 ++++++++++++++++++++++++--
+  1 file changed, 24 insertions(+), 2 deletions(-)
+
+
 2007-04-12 19:02:56 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [2016]
   - if handle->cancel = TRUE, immediately abort the fread operation.
--- a/src/curl/curl.c	Thu Apr 12 12:33:04 2007 -0700
+++ b/src/curl/curl.c	Thu Apr 12 12:57:45 2007 -0700
@@ -32,7 +32,7 @@
 #define BUFFER_SIZE 256 * 1024
 #define REVERSE_SEEK_SIZE 2048
 
-#define DEBUG_CONNECTION 1
+#define DEBUG_CONNECTION 0
 #define DEBUG_OPEN_CLOSE 1
 #define DEBUG_SEEK 0
 #define DEBUG_READ 0
@@ -83,8 +83,6 @@
   } proxy_info;
   
   gchar *local_ip;
-
-  GMutex *curl_mutex;
 };
 
 void curl_vfs_rewind_impl(VFSFile * file);
@@ -463,14 +461,6 @@
   if (DEBUG_CONNECTION)
     g_print("Connect %p\n", handle);
 
-  g_mutex_lock(handle->curl_mutex);
-
-  if (handle->curl == NULL)
-  {
-      g_mutex_unlock(handle->curl_mutex);
-      return NULL;
-  }
-
   if (handle->no_data)
     curl_easy_setopt(handle->curl, CURLOPT_NOBODY, 1);
   else
@@ -488,7 +478,6 @@
   handle->icy_interval = 0;
 
   result = curl_easy_perform(handle->curl);
-
   if (result == CURLE_OK)
     update_length(handle);
   // We expect to get CURLE_WRITE_ERROR if we cancel.
@@ -500,15 +489,10 @@
     {
       g_print("Got curl error %d: %s\n", result, curl_easy_strerror(result));
       handle->failed = 1;
-      curl_easy_cleanup(handle->curl);
-      handle->curl = NULL;
     }
   if (DEBUG_CONNECTION)
     g_print("Done %p%s", handle, handle->cancel ? " (aborted)\n" : "\n");
   handle->cancel = 1;
-
-  g_mutex_unlock(handle->curl_mutex);
-
   return NULL;
 }
 
@@ -578,7 +562,6 @@
   handle->failed = 0;
   handle->no_data = 0;
   handle->stream_stack = NULL;
-  handle->curl_mutex = g_mutex_new();
 
   curl_easy_setopt(handle->curl, CURLOPT_URL, url);
   curl_easy_setopt(handle->curl, CURLOPT_WRITEFUNCTION, curl_writecb);
@@ -680,12 +663,7 @@
 	g_free(handle->name);
       if (handle->stream_stack != NULL)
         g_slist_free(handle->stream_stack);
-
-      if (handle->curl != NULL)
-        curl_easy_cleanup(handle->curl);
-
-      if (handle->curl_mutex != NULL)
-        g_mutex_free(handle->curl_mutex);
+      curl_easy_cleanup(handle->curl);
 
       if (handle->local_ip != NULL)
         g_free(handle->local_ip);
@@ -751,8 +729,6 @@
 	  //g_print("Wait for data on %p\n", handle);
 	  g_usleep(10000);
 	}
-      if (handle->cancel)
-          return (ret / size);
       if (available > sz - ret)
 	available = sz - ret;
       memcpy(ptr + ret, handle->buffer + handle->rd_index, available);