Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cURL deprecated warning #171

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions core/io_poller.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,14 @@ io_poller_perform(struct io_poller *io)
if (curlm->should_perform
|| (-1 != curlm->timeout && now >= curlm->timeout)) {
curlm->should_perform = false;
int result =
curlm->cb
? curlm->cb(io, curlm->multi, curlm->user_data)
: curl_multi_socket_all(curlm->multi, &curlm->running);

int result;
if (curlm->cb) {
result = curlm->cb(io, curlm->multi, curlm->user_data);
} else {
result = curl_multi_socket_action(curlm->multi, CURL_SOCKET_TIMEOUT, 0, &curlm->running);
if (result == CURLM_OK) result = curl_multi_perform(curlm->multi, &curlm->running);
}

if (result != 0) return result;
}
Expand Down
8 changes: 7 additions & 1 deletion core/websockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,16 @@ ws_multi_socket_run(struct websockets *ws, uint64_t *tstamp)
/** update WebSockets concept of "now" */
*tstamp = ws_timestamp_update(ws);

mcode = curl_multi_socket_all(ws->mhandle, &is_running);
mcode = curl_multi_socket_action(ws->mhandle, CURL_SOCKET_TIMEOUT, 0, &is_running);

if (mcode != CURLM_OK) CURLM_LOG(ws, mcode);

if (CURLM_OK != curl_multi_perform(ws->mhandle, &is_running)) {
logconf_error(&ws->conf, "curl_multi_perform() failed");

return false;
}

return is_running != 0;
}

Expand Down
8 changes: 7 additions & 1 deletion src/discord-rest_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ discord_requestor_info_read(struct discord_requestor *rqtor)
{
int alive = 0;

if (CURLM_OK != curl_multi_socket_all(rqtor->mhandle, &alive))
if (CURLM_OK != curl_multi_socket_action(rqtor->mhandle, CURL_SOCKET_TIMEOUT, 0, &alive))
return CCORD_CURLM_INTERNAL;

/* ask for any messages/informationals from the individual transfers */
Expand Down Expand Up @@ -445,6 +445,12 @@ discord_requestor_info_read(struct discord_requestor *rqtor)
}
}

int still_running = 0;

/* Check if there are still running transfers */
if (CURLM_OK != curl_multi_perform(rqtor->mhandle, &still_running))
return CCORD_CURLM_INTERNAL;

return CCORD_OK;
}

Expand Down
Loading