Beispiel #1
0
bool LLPumpIO::setConditional(LLIOPipe* pipe, const apr_pollfd_t* poll)
{
	LLMemType m1(LLMemType::MTYPE_IO_PUMP);
	if(!pipe) return false;
	ll_debug_poll_fd("Set conditional", poll);

	lldebugs << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null")
		 << ") "
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
		 << "on pipe " << typeid(*pipe).name() 
#endif
		 << " at " << pipe << llendl;

	// remove any matching poll file descriptors for this pipe.
	LLIOPipe::ptr_t pipe_ptr(pipe);
	LLChainInfo::conditionals_t::iterator it;
	it = (*mCurrentChain).mDescriptors.begin();
	while(it != (*mCurrentChain).mDescriptors.end())
	{
		LLChainInfo::pipe_conditional_t& value = (*it);
		if(pipe_ptr == value.first)
		{
			ll_delete_apr_pollset_fd_client_data()(value);
			it = (*mCurrentChain).mDescriptors.erase(it);
			mRebuildPollset = true;
		}
		else
		{
			++it;
		}
	}

	if(!poll)
	{
		mRebuildPollset = true;
		return true;
	}
	LLChainInfo::pipe_conditional_t value;
	value.first = pipe_ptr;
	value.second = *poll;
	value.second.rtnevents = 0;
	if(!poll->p)
	{
		// each fd needs a pool to work with, so if one was
		// not specified, use this pool.
		// *FIX: Should it always be this pool?
		value.second.p = mPool;
	}
	value.second.client_data = new S32(++mPollsetClientID);
	(*mCurrentChain).mDescriptors.push_back(value);
	mRebuildPollset = true;
	return true;
}
Beispiel #2
0
bool LLPumpIO::setConditional(LLIOPipe* pipe, const apr_pollfd_t* poll)
{
	LLMemType m1(LLMemType::MTYPE_IO_PUMP);
	//lldebugs << "LLPumpIO::setConditional" << llendl;
	if(pipe)
	{
		// remove any matching poll file descriptors for this pipe.
		LLIOPipe::ptr_t pipe_ptr(pipe);
		LLChainInfo::conditionals_t::iterator it;
		it = (*mCurrentChain).mDescriptors.begin();
		while(it != (*mCurrentChain).mDescriptors.end())
		{
			LLChainInfo::pipe_conditional_t& value = (*it);
			if(pipe_ptr == value.first)
			{
				ll_delete_apr_pollset_fd_client_data()(value);
				it = (*mCurrentChain).mDescriptors.erase(it);
				mRebuildPollset = true;
			}
			else
			{
				++it;
			}
		}

		if(poll)
		{
			LLChainInfo::pipe_conditional_t value;
			value.first = pipe_ptr;
			value.second = *poll;
			if(!poll->p)
			{
				// each fd needs a pool to work with, so if one was
				// not specified, use this pool.
				// *FIX: Should it always be this pool?
				value.second.p = mPool;
			}
			value.second.client_data = new S32(++mPollsetClientID);
			(*mCurrentChain).mDescriptors.push_back(value);
			mRebuildPollset = true;
		}
		return true;
	}
	return false;
}