Ejemplo n.º 1
0
	bool processSocket(bool expectingPacket)
	{
		int len = pNextPacket_->recvFromEndPoint(socket_);
		if (len <= 0)
		{
			return this->checkSocketErrors(len, expectingPacket);
		}

		PacketPtr curPacket = pNextPacket_;
		pNextPacket_ = new TCPPacket();
		Address srcAddr = socket_.getRemoteAddress();
		Reason ret = this->processPacket(srcAddr, curPacket.get());

		if (ret != REASON_SUCCESS)
		{
			this->dispatcher().errorReporter().reportException(ret, srcAddr);
		}
		return true;
	}
void ApplicationBarrierManager::handlePacket(PacketPtr packet, gadget::NodePtr node)
{
   vprDEBUG(gadgetDBG_RIM, vprDBG_HVERB_LVL)
         << clrOutBOLD(clrMAGENTA,"[ApplicationBarrierManager::handlePacket()]")
         << "In handlePacket.\n" << vprDEBUG_FLUSH;

   if ( NULL != packet.get() && NULL != node.get() )
   {
      switch ( packet->getPacketType() )
      {
      case cluster::Header::RIM_DATA_PACKET:
      {
         DataPacketPtr data_packet = boost::dynamic_pointer_cast<DataPacket>(packet);
         vprASSERT(NULL != data_packet.get() && "Dynamic cast failed!");

         // Find the ApplicationBarrier Object that we have received data
         // for.
         ApplicationBarrier* barrier =
            getApplicationBarrier(data_packet->getObjectId());

         if (barrier != NULL)
         {
            // Parse the object's data using the temporary ObjectReader
            barrier->incWaitingNodes();
         }
         else
         {
            vprDEBUG(gadgetDBG_RIM,vprDBG_WARNING_LVL)
               << clrOutBOLD(clrCYAN,"[ApplicationBarrierManager] ")
               << "Got data for an unknown ApplicationBarrier object: "
               << data_packet->getObjectId() << std::endl << vprDEBUG_FLUSH;
         }
         break;
      }
      default:
         vprDEBUG(gadgetDBG_RIM,vprDBG_WARNING_LVL)
            << clrOutBOLD(clrCYAN,"[ApplicationBarrierManager] ")
            << "Don't know how to handle a packet of type: "
            << packet->getPacketType() << std::endl << vprDEBUG_FLUSH;
         break;
      }
   }
}
Ejemplo n.º 3
0
	const Packet * next() const	{ return next_.get(); }
Ejemplo n.º 4
0
	Packet * next()				{ return next_.get(); }