automatically logout all accounts
This commit is contained in:
@@ -114,7 +114,6 @@ dc_api_do(dc_api_t api, char const *verb,
|
||||
dc_api_sync_t sync = NULL;
|
||||
struct curl_slist *l = NULL;
|
||||
char *tmp = NULL;
|
||||
int ptr = 0;
|
||||
|
||||
c = curl_easy_init();
|
||||
goto_if_true(c == NULL, cleanup);
|
||||
@@ -162,10 +161,10 @@ dc_api_do(dc_api_t api, char const *verb,
|
||||
}
|
||||
|
||||
if (data != NULL) {
|
||||
curl_easy_setopt(c, CURLOPT_COPYPOSTFIELDS, data);
|
||||
if (len >= 0) {
|
||||
curl_easy_setopt(c, CURLOPT_POSTFIELDSIZE_LARGE, len);
|
||||
}
|
||||
curl_easy_setopt(c, CURLOPT_COPYPOSTFIELDS, data);
|
||||
}
|
||||
|
||||
if (strcmp(verb, "PUT") == 0 ||
|
||||
@@ -178,8 +177,6 @@ dc_api_do(dc_api_t api, char const *verb,
|
||||
}
|
||||
|
||||
g_hash_table_insert(api->syncs, c, dc_ref(sync));
|
||||
curl_multi_socket_action(api->curl, CURL_SOCKET_TIMEOUT, 0, &ptr);
|
||||
|
||||
ret = true;
|
||||
|
||||
cleanup:
|
||||
|
||||
@@ -30,8 +30,18 @@ static void dc_api_sync_free(dc_api_sync_t s)
|
||||
pthread_cond_destroy(&s->cnd);
|
||||
pthread_mutex_destroy(&s->mtx);
|
||||
|
||||
curl_multi_remove_handle(s->curl, s->easy);
|
||||
curl_easy_cleanup(s->easy);
|
||||
if (s->list != NULL) {
|
||||
curl_slist_free_all(s->list);
|
||||
s->list = NULL;
|
||||
}
|
||||
|
||||
if (s->easy != NULL) {
|
||||
if (s->curl != NULL) {
|
||||
curl_multi_remove_handle(s->curl, s->easy);
|
||||
}
|
||||
curl_easy_cleanup(s->easy);
|
||||
s->easy = NULL;
|
||||
}
|
||||
|
||||
if (s->stream != NULL) {
|
||||
fclose(s->stream);
|
||||
@@ -42,9 +52,6 @@ static void dc_api_sync_free(dc_api_sync_t s)
|
||||
s->buffer = NULL;
|
||||
s->bufferlen = 0;
|
||||
|
||||
curl_slist_free_all(s->list);
|
||||
s->list = NULL;
|
||||
|
||||
free(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ dc_loop_t dc_loop_new_full(struct event_base *base, CURLM *multi)
|
||||
curl_multi_setopt(ptr->multi, CURLMOPT_TIMERDATA, ptr);
|
||||
curl_multi_setopt(ptr->multi, CURLMOPT_TIMERFUNCTION, mcurl_timer);
|
||||
|
||||
return ptr;
|
||||
return dc_ref(ptr);
|
||||
|
||||
fail:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user