Show
Ignore:
Timestamp:
06/21/07 15:31:51 (1 year ago)
Author:
aronb
Message:

MF20 r20316: Hack to ensure that we don't start listening for connections until we have fully configured all other nodes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/branches/2.2/modules/gadgeteer/gadget/AbstractNetworkManager.cpp

    r20010 r20317  
    401401   } 
    402402 
     403   struct ElementPred 
     404   { 
     405      ElementPred(const std::string& type) 
     406         : mType(type) 
     407      { 
     408         /* Do nothing. */ ; 
     409      } 
     410 
     411      bool operator()(const jccl::ConfigManager::PendingElement& p) 
     412      { 
     413         return p.mElement->getID() == mType; 
     414      } 
     415 
     416      const std::string mType; 
     417   }; 
     418 
    403419   bool AbstractNetworkManager::configAdd(jccl::ConfigElementPtr element) 
    404420   { 
     
    413429         if (isLocalHost( element->getProperty<std::string>( "host_name" ) )) 
    414430         { 
     431            // XXX: Hack to ensure that we don't start listening for connections until 
     432            //      we have fully configured all other nodes. 
     433            ElementPred pred(getClusterNodeElementType()); 
     434 
     435            jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance(); 
     436            unsigned int num_pending_nodes = 
     437               std::count_if(cfg_mgr->getPendingBegin(), cfg_mgr->getPendingEnd(), pred); 
     438 
     439            if (num_pending_nodes > 1) 
     440            { 
     441               vprDEBUG( gadgetDBG_NET_MGR, vprDBG_CONFIG_LVL ) << clrSetBOLD(clrRED) 
     442                  << clrOutBOLD( clrMAGENTA,"[AbstractNetworkManager]" ) 
     443                  << " Some nodes not configured yet: " << num_pending_nodes 
     444                  << clrRESET << std::endl << vprDEBUG_FLUSH; 
     445               return false; 
     446            } 
     447 
    415448            // NOTE: Add all machine dependent ConfigElementPtr's here 
    416449            vprASSERT( element->getNum("display_system") == 1