mirror of
https://github.com/curl/curl.git
synced 2026-07-27 20:53:18 +03:00
examples: check more errors, fix cleanups, scope variables
Inspired by Joshua's report on examples. Closes #19055
This commit is contained in:
parent
61dcb56743
commit
64ed2ea196
42 changed files with 874 additions and 785 deletions
|
|
@ -241,21 +241,22 @@ int main(int argc, char **argv)
|
|||
uv_timer_init(uv.loop, &uv.timeout);
|
||||
|
||||
uv.multi = curl_multi_init();
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_SOCKETFUNCTION, cb_socket);
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_SOCKETDATA, &uv);
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_TIMERFUNCTION, cb_timeout);
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_TIMERDATA, &uv);
|
||||
if(uv.multi) {
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_SOCKETFUNCTION, cb_socket);
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_SOCKETDATA, &uv);
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_TIMERFUNCTION, cb_timeout);
|
||||
curl_multi_setopt(uv.multi, CURLMOPT_TIMERDATA, &uv);
|
||||
|
||||
while(argc-- > 1) {
|
||||
add_download(argv[argc], argc, uv.multi);
|
||||
while(argc-- > 1) {
|
||||
add_download(argv[argc], argc, uv.multi);
|
||||
}
|
||||
|
||||
/* kickstart the thing */
|
||||
curl_multi_socket_action(uv.multi, CURL_SOCKET_TIMEOUT, 0,
|
||||
&running_handles);
|
||||
uv_run(uv.loop, UV_RUN_DEFAULT);
|
||||
curl_multi_cleanup(uv.multi);
|
||||
}
|
||||
|
||||
/* kickstart the thing */
|
||||
curl_multi_socket_action(uv.multi, CURL_SOCKET_TIMEOUT, 0, &running_handles);
|
||||
uv_run(uv.loop, UV_RUN_DEFAULT);
|
||||
curl_multi_cleanup(uv.multi);
|
||||
curl_global_cleanup();
|
||||
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue