[asterisk-commits] kpfleming: trunk r48526 - /trunk/funcs/func_curl.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Dec 16 14:24:08 MST 2006


Author: kpfleming
Date: Sat Dec 16 15:24:08 2006
New Revision: 48526

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48526
Log:
update to use trunk's version of the threadstorage API

Modified:
    trunk/funcs/func_curl.c

Modified: trunk/funcs/func_curl.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_curl.c?view=diff&rev=48526&r1=48525&r2=48526
==============================================================================
--- trunk/funcs/func_curl.c (original)
+++ trunk/funcs/func_curl.c Sat Dec 16 15:24:08 2006
@@ -84,6 +84,21 @@
 
 static const char *global_useragent = "asterisk-libcurl-agent/1.0";
 
+static int curl_instance_init(void *data)
+{
+	CURL **curl = data;
+
+	if (!(*curl = curl_easy_init()))
+		return -1;
+
+	curl_easy_setopt(*curl, CURLOPT_NOSIGNAL, 1);
+	curl_easy_setopt(*curl, CURLOPT_TIMEOUT, 180);
+	curl_easy_setopt(*curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
+	curl_easy_setopt(*curl, CURLOPT_USERAGENT, global_useragent);
+
+	return 0;
+}
+
 static void curl_instance_cleanup(void *data)
 {
 	CURL **curl = data;
@@ -99,15 +114,6 @@
 
 	if (!(curl = ast_threadstorage_get(&curl_instance, sizeof(*curl))))
 		return -1;
-
-	if (!*curl) {
-		if (!(*curl = curl_easy_init()))
-			return -1;
-		curl_easy_setopt(*curl, CURLOPT_NOSIGNAL, 1);
-		curl_easy_setopt(*curl, CURLOPT_TIMEOUT, 180);
-		curl_easy_setopt(*curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
-		curl_easy_setopt(*curl, CURLOPT_USERAGENT, global_useragent);
-	}
 
 	curl_easy_setopt(*curl, CURLOPT_URL, url);
 	curl_easy_setopt(*curl, CURLOPT_WRITEDATA, (void *) chunk);



More information about the asterisk-commits mailing list