http_transaction_set_http_auth_scheme(transaction, auth_scheme);
_set_authentication_info(transaction);
}
- transaction->completed_cb(transaction, transaction->completed_user_data);
+ if (transaction->completed_cb)
+ transaction->completed_cb(transaction, transaction->completed_user_data);
}
break;
CURLMcode ret;
+ if (session == NULL || session->multi_handle == NULL)
+ return FALSE;
+
ret = curl_multi_socket_action(session->multi_handle, CURL_SOCKET_TIMEOUT, 0, &(session->still_running));
if (ret == CURLM_OK)
DBG("CURLM_OK - Called curl_multi_socket_action()\n");
else
print_curl_multi_errorCode(ret);
- _check_curl_multi_status(session);
if (running_handles > 0) {
+ _check_curl_multi_status(session);
return TRUE;
} else {
DBG("last transfer done, kill timeout\n");
g_source_remove(session->timer_event);
session->timer_event = 0;
}
+ _check_curl_multi_status(session);
return FALSE;
}
}
{
__http_session_h* session = (__http_session_h *)user_data;
+ if (session->timer_event) {
+ g_source_remove(session->timer_event);
+ session->timer_event = 0;
+ }
+
session->timer_event = g_timeout_add(timeout_ms , timer_expired_callback , session);
return 0;
session->active_transaction_count = 0;
session->session_mode = mode;
session->auto_redirect = FALSE;
+ session->timer_event = 0;
curl_multi_setopt(session->multi_handle, CURLMOPT_SOCKETFUNCTION, __handle_socket_cb);
curl_multi_setopt(session->multi_handle, CURLMOPT_SOCKETDATA, session);
session->active_transaction_count--;
if (transaction) {
+ if (transaction->thread_loop != NULL) {
+ g_main_loop_quit((GMainLoop*)transaction->thread_loop);
+
+ g_main_loop_unref(transaction->thread_loop);
+ transaction->thread_loop = NULL;
+ }
+
+ if (transaction->thread != NULL) {
+ g_thread_join(transaction->thread);
+ transaction->thread = NULL;
+ }
+
if (transaction->easy_handle != NULL) {
curl_easy_cleanup(transaction->easy_handle);
transaction->easy_handle = NULL;
_remove_transaction_from_list(transaction);
- if (transaction->thread_loop != NULL) {
- g_main_loop_quit((GMainLoop*)transaction->thread_loop);
-
- g_main_loop_unref(transaction->thread_loop);
- transaction->thread_loop = NULL;
- }
-
- if (transaction->thread != NULL) {
- g_thread_join(transaction->thread);
- transaction->thread = NULL;
- }
-
free(transaction);
transaction = NULL;
}