void _add_transaction_to_list(http_transaction_h http_transaction);
void _remove_transaction_from_list(http_transaction_h http_transaction);
void _remove_transaction_list(void);
+void _destroy_transactions(int session_id);
curl_http_auth_scheme_e _get_http_curl_auth_scheme(http_auth_scheme_e auth_scheme);
http_auth_scheme_e _get_http_auth_scheme(bool proxy_auth, curl_http_auth_scheme_e curl_auth_scheme);
int _set_authentication_info(http_transaction_h http_transaction);
session->multi_handle = NULL;
}
+ if (session->active_transaction_count)
+ _destroy_transactions(session->session_id);
+
session->active_transaction_count = 0;
session->still_running = 0;
session->auto_redirect = FALSE;
return HTTP_ERROR_NONE;
}
+
+API int http_session_destroy_all_transactions(http_session_h http_session)
+{
+ _retvm_if(_http_is_init() == false, HTTP_ERROR_INVALID_OPERATION,
+ "http isn't initialized");
+ _retvm_if(http_session == NULL, HTTP_ERROR_INVALID_PARAMETER,
+ "parameter(http_session) is NULL\n");
+
+ __http_session_h *session = (__http_session_h *)http_session;
+
+ _destroy_transactions(session->session_id);
+
+ return HTTP_ERROR_NONE;
+}
+
#include "http.h"
#include "http_private.h"
-static __thread GSList *transaction_list = NULL;
+static __thread GList *transaction_list = NULL;
//LCOV_EXCL_START
void _add_transaction_to_list(http_transaction_h http_transaction)
{
- transaction_list = g_slist_append(transaction_list, http_transaction);
+ transaction_list = g_list_append(transaction_list, http_transaction);
}
void _remove_transaction_from_list(http_transaction_h http_transaction)
{
- transaction_list = g_slist_remove(transaction_list, http_transaction);
+ transaction_list = g_list_remove(transaction_list, http_transaction);
}
void _remove_transaction_list(void)
{
- g_slist_free_full(transaction_list, g_free);
+ g_list_free_full(transaction_list, g_free);
transaction_list = NULL;
}
+
+void _destroy_transactions(int session_id)
+{
+ int ret = 0;
+ GList *list = transaction_list;
+
+ while (list) {
+ __http_transaction_h *transaction = (__http_transaction_h *)list->data;
+ if (session_id == transaction->session->session_id) {
+ DBG("PREV[%p] NEXT[%p]", list->prev, list->next);
+ if (list->prev)
+ list = list->prev;
+ else
+ list = list->next;
+
+ ret = http_transaction_destroy((http_transaction_h) transaction);
+ if (ret != HTTP_ERROR_NONE)
+ ERR("Fail to destroy transaction!!");
+
+ continue;
+ }
+ list = list->next;
+ }
+}
//LCOV_EXCL_STOP
curl_socket_t __handle_opensocket_cb(void *client_fd, curlsocktype purpose, struct curl_sockaddr *address)
return HTTP_ERROR_NONE;
}
-API int http_session_destroy_all_transactions(http_session_h http_session)
-{
- _retvm_if(_http_is_init() == false, HTTP_ERROR_INVALID_OPERATION,
- "http isn't initialized");
- _retvm_if(http_session == NULL, HTTP_ERROR_INVALID_PARAMETER,
- "parameter(http_session) is NULL\n");
-
- int ret = 0;
- GSList *list = NULL;
- __http_session_h *session = (__http_session_h *)http_session;
-
- for (list = transaction_list; list; list = list->next) {
- __http_transaction_h *transaction = (__http_transaction_h *)list->data;
- if (session->session_id == transaction->session->session_id) {
- _remove_transaction_from_list(list->data);
- ret = http_transaction_destroy((http_transaction_h) transaction);
- if (ret != HTTP_ERROR_NONE) {
- ERR("Fail to destroy transaction!!");
- return HTTP_ERROR_OPERATION_FAILED;
- }
- }
- }
-
- return HTTP_ERROR_NONE;
-}
//LCOV_EXCL_START
API int http_transaction_set_http_auth_scheme(http_transaction_h http_transaction, http_auth_scheme_e auth_scheme)
{