added fetcher_finalize() to clean up libcurl

This commit is contained in:
Andreas Steffen
2007-03-08 17:00:32 +00:00
parent 8b8dd69dee
commit 54645fb275
3 changed files with 24 additions and 1 deletions
+1
View File
@@ -505,6 +505,7 @@ int main(int argc, char *argv[])
run(private_charon);
eap_method_unload();
fetcher_finalize();
/* normal termination, cleanup and exit */
destroy(private_charon);
unlink(PID_FILE);
+14 -1
View File
@@ -173,7 +173,7 @@ void fetcher_initialize(void)
#ifdef LIBCURL
CURLcode res;
/* init libcurl */
/* initialize libcurl */
DBG1("initializing libcurl");
res = curl_global_init(CURL_GLOBAL_NOTHING);
if (res != CURLE_OK)
@@ -182,3 +182,16 @@ void fetcher_initialize(void)
}
#endif /* LIBCURL */
}
/**
* Described in header.
*/
void fetcher_finalize(void)
{
#ifdef LIBCURL
/* finalize libcurl */
DBG1("finalizing libcurl");
curl_global_cleanup();
#endif /* LIBCURL */
}
+9
View File
@@ -83,4 +83,13 @@ fetcher_t* fetcher_create(const char *uri);
*/
void fetcher_initialize(void);
/**
* @brief Finalizes the fetcher_t class
*
* call this function only once befor exiting the main program
*
* @ingroup utils
*/
void fetcher_finalize(void);
#endif /*FETCHER_H_*/