Yeah, It may be caused by system difference. It's hard to find problems.
But eocre_con_url should run independently.

I have made libcurl testing application. It's almost same
implementation as ecore_con_url's stuff.
Can you test attached curl test ?  when testing it,  redirect standard
out to /dev/null. ( "curl_test > /dev/null" )
If this works well, maybe something wrong exists in my patch.

2012/2/19 Michael Blumenkrantz <[email protected]>:
> On Sat, 18 Feb 2012 16:03:53 +0900
> Carsten Haitzler (The Rasterman) <[email protected]> wrote:
>
>> On Fri, 17 Feb 2012 21:40:37 -0500 Michael Blumenkrantz
>> <[email protected]> said:
>>
>> > Hi,
>> >
>> > Attached is a very tiny demo which showcases a pretty huge (imo) bug in
>> > ecore-con-url: multiple simultaneous fetches are broken. When more than one
>> > curl object is added, only the last one will actually be fetched.
>>
>> can't reproduce. i expanded your demo to call progress/data/complete
>> callbacks. attached src and log. downloads both urls - in parallel (well for
>> the first bit). the first 33.9kb data is fetched completely as is the 64.8k
>> data. i haven't actually checked the data itself - but everything else is
>> showing "all ok". no proxy set up here for this test btw. i ran a second test
>> with a proxy (well proxy fwd'd via an ssh tunnel to the other side of the
>> world) and it works too with slightly different fetch ordering.
>>
>> attached logs+src. my svn updated and completely rebuilt just before this 
>> test
>> was run.
>>
> I've attached two logs from your updated example:
> ecore_con_url.log is from current ecore-con
> ecore_con_url-old.log is from 65835 (prior to the commit I cited)
>
> At present, there is no data downloaded for the first URL. It seems to be
> somehow system-dependent, though not curl version dependent as I have tested
> older versions with no change.
>
> Since I don't typically work on curl stuff, it would be great if someone could
> point me in the right direction for trying to debug this.
>
> The only other alternative, if this cannot be fixed prior to release, is to
> revert r65888 and then rebase every subsequent commit on top of the old code.
> In cases like this it's rarely just one person who has a bug, so I would 
> rather
> release with the old and working code than what is currently in svn.



-- 
BRs,
Kim.
#include <curl/curl.h>

static CURLM *_curlm;

static int
_url_progress_cb(void *data, double dltotal, double dlnow, double ultotal, double ulnow)
{
	fprintf(stderr, "Progress: %lf/%lf\n", dlnow, dltotal);
	return 0;
}

CURL *create_easy(const char *url)
{
	CURL *curl_easy = curl_easy_init();
	if (!curl_easy) {
		fprintf(stderr, "curl_easy_init() failed");
		return NULL;
	}
	curl_easy_setopt(curl_easy, CURLOPT_ENCODING, "gzip,deflate");
	curl_easy_setopt(curl_easy, CURLOPT_PROGRESSFUNCTION, _url_progress_cb);
	curl_easy_setopt(curl_easy, CURLOPT_PROGRESSDATA, NULL);
	curl_easy_setopt(curl_easy, CURLOPT_NOPROGRESS, 0);
	curl_easy_setopt(curl_easy, CURLOPT_CONNECTTIMEOUT, 30);
	curl_easy_setopt(curl_easy, CURLOPT_FOLLOWLOCATION, 1);
	curl_easy_setopt(curl_easy, CURLOPT_POSTFIELDSIZE, 0);
	curl_easy_setopt(curl_easy, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
	curl_easy_setopt(curl_easy, CURLOPT_HTTPHEADER, NULL);

	curl_easy_setopt(curl_easy, CURLOPT_URL, url);
	return curl_easy;
}

int main()
{
	CURL *curl_easy;
	if (curl_global_init(CURL_GLOBAL_ALL) != 0) {
		fprintf(stderr, "curl_global_init() failed");
		return -1;
	}
	_curlm = curl_multi_init();
	if (!_curlm) {
		fprintf(stderr, "curl_multi_init() failed");
		return -1;
	}

	curl_easy = create_easy("http://www.dreamincode.net/forums/uploads/monthly_05_2010/post-380028-12747928967239.jpg.pagespeed.ce.yRppR_j7ae.jpg";);
	curl_multi_add_handle(_curlm, curl_easy);
	curl_easy = create_easy("http://www.prelovac.com/vladimir/wp-content/uploads/2008/03/example.jpg";);
	curl_multi_add_handle(_curlm, curl_easy);

	int still_running;
	curl_multi_perform(_curlm, &still_running);
	while(still_running) {
		struct timeval timeout;
		int rc;

		fd_set fdread;
		fd_set fdwrite;
		fd_set fdexcep;
		int maxfd = -1;

		long curl_timeo = -1;

		FD_ZERO(&fdread);
		FD_ZERO(&fdwrite);
		FD_ZERO(&fdexcep);

		timeout.tv_sec = 1;
		timeout.tv_usec = 0;

		curl_multi_timeout(_curlm, &curl_timeo);
		if(curl_timeo >= 0) {
			timeout.tv_sec = curl_timeo / 1000;
			if(timeout.tv_sec > 1)
				timeout.tv_sec = 1;
			else
				timeout.tv_usec = (curl_timeo % 1000) * 1000;
		}

		curl_multi_fdset(_curlm, &fdread, &fdwrite, &fdexcep, &maxfd);

		rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);

		switch(rc) {
			case -1:
				fprintf(stderr, "select error!!!\n");
				return -1;
				break;
			case 0:
			default:
				fprintf(stderr, "Perform =======================================!\n");
				curl_multi_perform(_curlm, &still_running);
				fprintf(stderr, "Still running: %d===============================!\n", still_running);
				break;
		}
		CURLMsg *curlmsg;
		int remain;
		while ((curlmsg = curl_multi_info_read(_curlm, &remain))) {
			if (curlmsg->msg != CURLMSG_DONE) continue;
			if (curlmsg->data.result == CURLE_OK)
				fprintf(stderr, "CURL Done OK, remain:%d\n", remain);
			else
				fprintf(stderr, "CURL Done with fail(%d), remain:%d\n",
						curlmsg->data.result, remain);
		}


	}

	curl_multi_cleanup(_curlm);
	curl_easy_cleanup(curl_easy);
	return 0;
}
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to