Exemplo n.º 1
0
S32 LLCurl::Multi::process()
{
	if(!isValid())
	{
		return 0 ;
	}

	waitToComplete() ;

	if (getState() != STATE_COMPLETED)
	{
		return 0;
	}

	CURLMsg* msg;
	int msgs_in_queue;

	S32 processed = 0;
	while ((msg = info_read(&msgs_in_queue)))
	{
		++processed;
		if (msg->msg == CURLMSG_DONE)
		{
			U32 response = 0;
			Easy* easy = NULL ;

			{
				LLMutexLock lock(mEasyMutexp) ;
				easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle);
				if (iter != mEasyActiveMap.end())
				{
					easy = iter->second;
				}
			}

			if(easy)
			{
				response = easy->report(msg->data.result);
				removeEasy(easy);
			}
			else
			{
				response = 499;
				//*TODO: change to llwarns
				llerrs << "cleaned up curl request completed!" << llendl;
			}
			if (response >= 400)
			{
				// failure of some sort, inc mErrorCount for debugging and flagging multi for destruction
				++mErrorCount;
			}
		}
	}

	setState(STATE_READY);

	return processed;
}
Exemplo n.º 2
0
S32 LLCurl::Multi::process()
{
    perform();

    CURLMsg* msg;
    int msgs_in_queue;

    S32 processed = 0;
    while ((msg = info_read(&msgs_in_queue)))
    {
        ++processed;
        if (msg->msg == CURLMSG_DONE)
        {
            U32 response = 0;
            easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle);
            if (iter != mEasyActiveMap.end())
            {
                Easy* easy = iter->second;
                response = easy->report(msg->data.result);
                removeEasy(easy);
            }
            else
            {
                response = 499;
                //*TODO: change to llwarns
                llerrs << "cleaned up curl request completed!" << llendl;
            }
            if (response >= 400)
            {
                // failure of some sort, inc mErrorCount for debugging and flagging multi for destruction
                ++mErrorCount;
            }
        }
    }
    return processed;
}