Enlightenment CVS committal Author : englebass Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_file Modified Files: ecore_file_download.c Log Message: Limit curl run to 0.2 seconds. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_file/ecore_file_download.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ecore_file_download.c 10 Nov 2006 19:11:12 -0000 1.12 +++ ecore_file_download.c 13 Jan 2007 01:49:42 -0000 1.13 @@ -195,6 +195,7 @@ int flags; int n_remaining, still_running; Ecore_File_Download_Job *job; + double start = 0.0; job = calloc(1, sizeof(Ecore_File_Download_Job)); if (!job) return NULL; @@ -216,7 +217,7 @@ curl_easy_setopt(job->curl, CURLOPT_URL, url); curl_easy_setopt(job->curl, CURLOPT_WRITEDATA, job->file); - if(progress_cb) + if (progress_cb) { curl_easy_setopt(job->curl, CURLOPT_NOPROGRESS, FALSE); curl_easy_setopt(job->curl, CURLOPT_PROGRESSDATA, job); @@ -230,7 +231,11 @@ ecore_list_append(_job_list, job); curl_multi_add_handle(curlm, job->curl); - while (curl_multi_perform(curlm, &still_running) == CURLM_CALL_MULTI_PERFORM); + start = ecore_time_get(); + while (curl_multi_perform(curlm, &still_running) == CURLM_CALL_MULTI_PERFORM) + { + if ((ecore_time_get() - start) > 0.2) break; + } /* check for completed jobs */ while ((curlmsg = curl_multi_info_read(curlm, &n_remaining)) != NULL) @@ -312,9 +317,13 @@ Ecore_File_Download_Job *job; CURLMsg *curlmsg; int n_remaining, still_running; + double start = 0.0; - /* FIXME: Can this run for a long time? Maybe limit how long it can run */ - while (curl_multi_perform(curlm, &still_running) == CURLM_CALL_MULTI_PERFORM); + start = ecore_time_get(); + while (curl_multi_perform(curlm, &still_running) == CURLM_CALL_MULTI_PERFORM) + { + if ((ecore_time_get() - start) > 0.2) break; + } /* Loop jobs and check if any are done */ while ((curlmsg = curl_multi_info_read(curlm, &n_remaining)) != NULL) ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs