curl-library
curl timeout and system alarm
Date: Thu, 20 Aug 2015 20:21:39 +0800 (CST)
Hi all,
I use libcurl 7.24.0. I set curl in a thread like this:
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 5);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME,30);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 120);
and in another thread i use alarm() as below to do something ervery 60 seconds:
ret = alarm(60);
printf("alarm ret %d\n", ret);
while(1)
{
if (sigwait(&sig_mask, &signo) != 0)
{
printf("Fail to sigwait\n");
return NULL;
}
switch (signo)
{
case SIGALRM:
ret = alarm(60);
/* do somthing */
Sometimes, i got "curl_easy_perform() failed: Timeout was reached. " from libcurl, and submit data to server failed. But in fact, the sever get the data, i don't know why. Any suggestions? Thanks so much!:)
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-08-20