示例#1
0
文件: IPCC_Impl.cpp 项目: tfoerch/LMP
 void IpccImpl::do_sendConfig(
   const msg::ast::ConfigNack&  configNackMsg)
 {
   std::cout << "IPCC[" << getLocalCCId() << "].sendConfig()" << std::endl;
   // create and send Config
   if (m_configMsg)
   {
     m_configMsg.release();
   }
   {
     lmp::obj::config::ast::ConfigObjectSequence  configObjectSequence;
     {
       lmp::obj::config::ast::HelloConfig  helloConfig = { { true }, 0x009A, 0x01CF };
       configObjectSequence.push_back(lmp::obj::config::ast::ConfigCTypes(helloConfig));
     }
     lmp::msg::ast::Config  configMsg =
       { { isGoingDown(),
           isLMPRestart() },
         { { false }, getLocalCCId() },      // localCCId
         { { false }, ++m_messageId },      // messageId
         { { false }, getLocalNodeId() },      // localNodeId
         configObjectSequence  // configObjectss
       };
     m_configMsg = std::make_unique<lmp::msg::ast::Config>(configMsg);
     lmp::msg::ast::Message sendMessage = configMsg;
     lmp::cc::UDPMsgHandler::sendMessage(m_networkIFSocket,
                                         m_remote_endpoint,
                                         sendMessage);
   }
   m_configSend_timer.start();
 }
示例#2
0
文件: IPCC_Impl.cpp 项目: tfoerch/LMP
 void IpccImpl::do_sendConfigAck(
   const msg::ast::Config&  configMsg)
 {
   std::cout << "IPCC[" << getLocalCCId() << "].sendConfigAck()" << std::endl;
   updateConfig(configMsg);
   // create and send ConfigAck
   {
     lmp::msg::ast::ConfigAck configAckMsg =
       { { isGoingDown(),
           isLMPRestart() },
         { { false }, getLocalCCId() },      // localCCId
         { { false }, getLocalNodeId() },    // localNodeId
         { { false }, configMsg.m_localCCId.m_ccId },      // remoteCCId
         { { false }, configMsg.m_messageId.m_msgId },     // messageId
         { { false }, configMsg.m_localNodeId.m_nodeId }   // remoteNodeId
       };
     lmp::msg::ast::Message sendMessage = configAckMsg;
     lmp::cc::UDPMsgHandler::sendMessage(m_networkIFSocket,
                                         m_remote_endpoint,
                                         sendMessage);
   }
 }
sci_error_t SCI_Transporter::initLocalSegment() { 
  DBUG_ENTER("SCI_Transporter::initLocalSegment");
  Uint32 segmentSize = m_BufferSize; 
  Uint32 offset  = 0; 
  sci_error_t err; 
  if(!m_sciinit) { 
    for(Uint32 i=0; i<m_adapters ; i++) { 
      SCIOpen(&(sciAdapters[i].scidesc), FLAGS, &err); 
      sciAdapters[i].localSciNodeId=getLocalNodeId(i); 
      DBUG_PRINT("info", ("SCInode iD %d  adapter %d\n",  
	         sciAdapters[i].localSciNodeId, i)); 
      if(err != SCI_ERR_OK) { 
        DBUG_PRINT("error",
        ("Cannot open an SCI virtual device. Error code 0x%x", 
		   err)); 
	DBUG_RETURN(err); 
      } 
    } 
  } 
   
  m_sciinit=true; 
 
  SCICreateSegment(sciAdapters[0].scidesc,            
		   &(m_SourceSegm[0].localHandle),  
		   hostSegmentId(localNodeId, remoteNodeId),    
		   segmentSize,                
		   0, 
		   0, 
		   0,         
		   &err);             
   
  if(err != SCI_ERR_OK) { 
    DBUG_PRINT("error", ("Error creating segment, err = 0x%x", err));
    DBUG_RETURN(err); 
  } else { 
    DBUG_PRINT("info", ("created segment id : %d",
	       hostSegmentId(localNodeId, remoteNodeId))); 
  } 
   
  /** Prepare the segment*/ 
  for(Uint32 i=0; i < m_adapters; i++) { 
    SCIPrepareSegment((m_SourceSegm[0].localHandle),  
		      i, 
		      FLAGS, 
		      &err); 
     
    if(err != SCI_ERR_OK) { 
      DBUG_PRINT("error",
    ("Local Segment is not accessible by an SCI adapter. Error code 0x%x\n",
                  err)); 
      DBUG_RETURN(err); 
    } 
  } 
 
  
  m_SourceSegm[0].mappedMemory =  
    SCIMapLocalSegment((m_SourceSegm[0].localHandle), 
		       &(m_SourceSegm[0].lhm[0].map), 
		       offset, 
		       segmentSize, 
		       NULL, 
		       FLAGS, 
		       &err); 
 
 
 
  if(err != SCI_ERR_OK) { 
    DBUG_PRINT("error", ("Cannot map area of size %d. Error code 0x%x", 
	        segmentSize,err)); 
    doDisconnect(); 
    DBUG_RETURN(err); 
  } 
  
  
  /** Make the local segment available*/ 
  for(Uint32 i=0; i < m_adapters; i++) { 
    SCISetSegmentAvailable((m_SourceSegm[0].localHandle),  
			     i, 
			   FLAGS, 
			   &err); 
     
    if(err != SCI_ERR_OK) { 
      DBUG_PRINT("error",
   ("Local Segment is not available for remote connections. Error code 0x%x\n",
                 err)); 
      DBUG_RETURN(err); 
    } 
  } 
  setupLocalSegment(); 
  DBUG_RETURN(err); 
   
} // initLocalSegment() 
示例#4
0
文件: IPCC_Impl.cpp 项目: tfoerch/LMP
 bool IpccImpl::do_isConntentionWinning(
   lmp::DWORD  remoteNodeId) const
 {
   return (getLocalNodeId() > remoteNodeId);
 }