当前位置: 首页>>代码示例>>C++>>正文


C++ TaskPtr::GetMessageQueue方法代码示例

本文整理汇总了C++中TaskPtr::GetMessageQueue方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskPtr::GetMessageQueue方法的具体用法?C++ TaskPtr::GetMessageQueue怎么用?C++ TaskPtr::GetMessageQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TaskPtr的用法示例。


在下文中一共展示了TaskPtr::GetMessageQueue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleResponses

void Peer::HandleResponses(WMessagePtr pWMsg)
{
	MessagePtr pMsg = pWMsg->GetMsg();

	// get the peer list if given in message
	std::vector<RemotePeers> peerList = pMsg->m_peerList;
	if( peerList.size() > 0 ) {
		long ts = pMsg->m_timestamp;
		this->HandlePeerList(peerList, ts);
	}

	// see if it is a task message
	if( pMsg->IsTaskMessage() ) {
		int msgTaskId = pMsg->m_taskId;
		// get the task and forward the message
		std::map<int, TaskPtr>::iterator it;
		it = m_taskList.find(msgTaskId);
		if( it != m_taskList.end() ) {
			TaskPtr pTask = (*it).second;
			pTask->GetMessageQueue()->PutMessage(pWMsg);
		}
		else {
			Log(CONSOLE, L"No Task Related to Task Response Message Received for taskId: %d\n", msgTaskId);
		}
		return;
	}

	switch(pMsg->m_respType) {
		case GET_ONLINE_RESP:
			HandleOnlineResp(pMsg);
			break;
		default:
			break;
	}
}
开发者ID:rudhirg,项目名称:P2PMapReduce,代码行数:35,代码来源:Peer.cpp

示例2: HandleConnectionFailure

// handle the connection failures
void Peer::HandleConnectionFailure(WMessagePtr pMsg)
{
	// see to which peer-node the connection failed
	// see if there is any task been alloted to that peer
	// see if there is any job been executed for that peer

	int failedConnPeer = pMsg->GetPeerId();
	// get the task and forward the failure message
	std::map<int, TaskPtr>::iterator it = m_taskList.begin();
	for( ;it != m_taskList.end(); it++ ) {
		TaskPtr pTask = (*it).second;
		pTask->GetMessageQueue()->PutMessage(pMsg);
	}
}
开发者ID:rudhirg,项目名称:P2PMapReduce,代码行数:15,代码来源:Peer.cpp

示例3: HandleTaskResult

void Peer::HandleTaskResult(WMessagePtr pWMsg)
{
	MessagePtr pMsg = pWMsg->GetMsg();
	Log(CONSOLE, L"Handling Task Result from Peer: %d, taskid: %d\n", 
											pMsg->m_fromPeerId, pMsg->m_taskId);

	PeerNodePtr pNode = pMsg->m_conn->GetPeerNode();
	// get the task and forward the message
	std::map<int, TaskPtr>::iterator it;
	it = m_taskList.find(pMsg->m_taskId);
	if( it != m_taskList.end() ) {
		TaskPtr pTask = (*it).second;
		pTask->GetMessageQueue()->PutMessage(pWMsg);
	}
	else {
		Log(CONSOLE, L"No Task Related to Task Result Message Received for taskId: %d\n", pMsg->m_taskId);
	}
}
开发者ID:rudhirg,项目名称:P2PMapReduce,代码行数:18,代码来源:Peer.cpp


注:本文中的TaskPtr::GetMessageQueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。