Changeset 3041 for source/ariba
- Timestamp:
- Apr 23, 2009, 9:18:12 AM (16 years ago)
- Location:
- source/ariba
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/AribaModule.h
r3037 r3041 161 161 BootstrapInfo() : 162 162 spovnetName(), nodes() { 163 164 163 } 165 164 166 165 BootstrapInfo(const BootstrapInfo& copy) : 167 166 spovnetName(copy.spovnetName), nodes(copy.nodes) { 168 169 167 } 170 168 -
source/ariba/Makefile.am
r3037 r3041 259 259 260 260 nobase_libariba_la_HEADERS += \ 261 interface/UnderlayAbstraction.h \262 interface/AribaContext.h \263 261 interface/ServiceInterface.h 264 262 -
source/ariba/Node.cpp
r3037 r3041 129 129 130 130 Node::Node(AribaModule& ariba_mod, const Name& node_name) : 131 ariba_mod(ariba_mod), name(node_name), base_overlay(NULL) { 131 ariba_mod(ariba_mod), name(node_name) { 132 base_overlay = new BaseOverlay(); 132 133 } 133 134 134 135 Node::~Node() { 136 delete base_overlay; 137 base_overlay = NULL; 135 138 } 136 139 … … 140 143 nodeId = generateNodeId(name); 141 144 142 //logging("joining spovnet on"143 // << " [spovnetid=]" << spovnetId.toString()144 // << " [nodeid=]" << nodeId.toString() );145 146 //logging_info("starting base communication...");147 145 ariba_mod.base_comm->start(ariba_mod.ip_addr, ariba_mod.tcp_port); 148 149 //logging_info("starting base overlay..."); 150 base_overlay = new BaseOverlay( *ariba_mod.base_comm, nodeId ); 146 base_overlay->start( *ariba_mod.base_comm, nodeId ); 151 147 152 148 const communication::EndpointDescriptor* ep = … … 165 161 nodeId = generateNodeId(name); 166 162 167 //logging("joining spovnet on"168 // << " [spovnetid=]" << spovnetId.toString()169 // << " [nodeid=]" << nodeId.toString() );170 171 //logging_info("starting base communication...");172 163 ariba_mod.base_comm->start(ariba_mod.ip_addr, ariba_mod.tcp_port); 173 164 174 //logging_info("starting base overlay..."); 175 base_overlay = new BaseOverlay( *ariba_mod.base_comm, nodeId ); 165 base_overlay->start( *ariba_mod.base_comm, nodeId ); 176 166 base_overlay->createSpoVNet( spovnetId ); 177 167 … … 184 174 ariba_mod.base_comm->stop(); 185 175 186 delete base_overlay; 187 base_overlay = NULL; 176 base_overlay->stop(); 188 177 } 189 178 -
source/ariba/overlay/BaseOverlay.cpp
r3037 r3041 47 47 use_logging_cpp(BaseOverlay); 48 48 49 BaseOverlay::BaseOverlay( BaseCommunication& _basecomm, const NodeID& _nodeid ) 50 : bc( _basecomm ), nodeId( _nodeid ), spovnetId( SpoVNetID::UNSPECIFIED), overlayInterface( NULL ), 51 initiatorLink( LinkID::UNSPECIFIED ), state( BaseOverlayStateInvalid ) { 49 BaseOverlay::BaseOverlay() 50 : bc(NULL), overlayInterface(NULL), 51 nodeId(NodeID::UNSPECIFIED), spovnetId(SpoVNetID::UNSPECIFIED), 52 initiatorLink(LinkID::UNSPECIFIED), state(BaseOverlayStateInvalid){ 53 } 54 55 BaseOverlay::~BaseOverlay(){ 56 } 57 58 void BaseOverlay::start( BaseCommunication& _basecomm, const NodeID& _nodeid ){ 59 60 bc = &_basecomm; 61 nodeId = _nodeid; 52 62 53 63 logging_info("creating base overlay"); 54 64 55 bc .registerMessageReceiver( this );56 bc .registerEventListener( this );65 bc->registerMessageReceiver( this ); 66 bc->registerEventListener( this ); 57 67 58 68 ovl.visCreate( ovlId, nodeId, string(""), string("") ); … … 75 85 } 76 86 77 BaseOverlay::~BaseOverlay() {87 void BaseOverlay::stop() { 78 88 79 89 logging_info("deleting base overlay"); 80 90 81 91 Timer::stop(); 82 bc .unregisterMessageReceiver( this );83 bc .unregisterEventListener( this );92 bc->unregisterMessageReceiver( this ); 93 bc->unregisterEventListener( this ); 84 94 } 85 95 … … 101 111 state = BaseOverlayStateJoinInitiated; 102 112 103 initiatorLink = bc.establishLink( bootstrapEp ); 113 initiatorLink = bc->establishLink( bootstrapEp ); 114 logging_info("join process initiated for " << id.toString() << "..."); 104 115 } 105 116 … … 124 135 // then, leave the spovnet baseoverlay 125 136 OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeBye, nodeId ); 126 bc .sendMessage( initiatorLink, &overMsg );137 bc->sendMessage( initiatorLink, &overMsg ); 127 138 128 139 // drop the link and set to correct state 129 bc .dropLink( initiatorLink );140 bc->dropLink( initiatorLink ); 130 141 initiatorLink = LinkID::UNSPECIFIED; 131 142 } … … 175 186 const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const LinkID& link) const { 176 187 177 return bc .getEndpointDescriptor( link );188 return bc->getEndpointDescriptor( link ); 178 189 } 179 190 … … 181 192 182 193 if( node == nodeId || node == NodeID::UNSPECIFIED ) 183 return bc .getEndpointDescriptor();194 return bc->getEndpointDescriptor(); 184 195 185 196 if( overlayInterface == NULL ){ … … 216 227 217 228 ServiceInterface* receiver = listenerMux.get( service ); 218 const LinkID link = bc .establishLink( ep );229 const LinkID link = bc->establishLink( ep ); 219 230 220 231 LinkItem item (link, NodeID::UNSPECIFIED, service, receiver); … … 237 248 238 249 LinkItem item = i->second; 239 bc .dropLink( link );250 bc->dropLink( link ); 240 251 241 252 if( item.interface != NULL ) … … 257 268 258 269 i->second.markused(); 259 return bc .sendMessage( link, &overmsg );270 return bc->sendMessage( link, &overmsg ); 260 271 } 261 272 … … 349 360 350 361 state = BaseOverlayStateJoinInitiated; // state remains in JoinInitiated 351 bc .sendMessage( id, &overMsg );362 bc->sendMessage( id, &overMsg ); 352 363 353 364 return; … … 384 395 ); 385 396 386 bc .sendMessage( id, &overMsg );397 bc->sendMessage( id, &overMsg ); 387 398 i->second.markused(); 388 399 … … 555 566 556 567 retmsg.encapsulate(&replyMsg); 557 bc .sendMessage( link, &retmsg );568 bc->sendMessage( link, &retmsg ); 558 569 559 570 return true; … … 597 608 if( ! replyMsg->getJoinAllowed() ){ 598 609 599 logging_ warn( "our join request has been denied" );600 601 bc .dropLink( initiatorLink );610 logging_error( "our join request has been denied" ); 611 612 bc->dropLink( initiatorLink ); 602 613 initiatorLink = LinkID::UNSPECIFIED; 603 614 state = BaseOverlayStateInvalid; … … 624 635 logging_error( "overlay structure not supported" ); 625 636 626 bc .dropLink( initiatorLink );637 bc->dropLink( initiatorLink ); 627 638 initiatorLink = LinkID::UNSPECIFIED; 628 639 state = BaseOverlayStateInvalid; … … 698 709 if( changed ){ 699 710 OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeUpdate, i->second.service, nodeId ); 700 bc .sendMessage( link, &overMsg );711 bc->sendMessage( link, &overMsg ); 701 712 } 702 713 … … 744 755 if( overlayMsg->getSourceNode() == spovnetInitiator ){ 745 756 746 bc .dropLink( initiatorLink );757 bc->dropLink( initiatorLink ); 747 758 initiatorLink = LinkID::UNSPECIFIED; 748 759 state = BaseOverlayStateInvalid; … … 800 811 for( ; i != iend; i++ ){ 801 812 if( *i == nodeId) continue; // don't send to ourselfs 802 sendMessage( message, *i, service ); // TODO: sollte auto links aufbauen fÃŒr sowas813 sendMessage( message, *i, service ); 803 814 } 804 815 } … … 857 868 void BaseOverlay::incomingRouteMessage(Message* msg){ 858 869 // gets handled as normal data message 859 // TODO: passt das so?860 870 receiveMessage( msg, LinkID::UNSPECIFIED, NodeID::UNSPECIFIED ); 861 871 } -
source/ariba/overlay/BaseOverlay.h
r3037 r3041 126 126 127 127 /** 128 * Constructs a Base Overlay instance129 */ 130 BaseOverlay( BaseCommunication& _basecomm, const NodeID& _nodeid);131 132 /** 133 * TODO128 * Constructs an empty non-functional base overlay instance 129 */ 130 BaseOverlay(); 131 132 /** 133 * Destructs a base overlay instance 134 134 */ 135 135 virtual ~BaseOverlay(); 136 137 /** 138 * Starts the Base Overlay instance 139 */ 140 void start( BaseCommunication& _basecomm, const NodeID& _nodeid ); 141 142 /** 143 * Stops the Base Overlay instance 144 */ 145 void stop(); 136 146 137 147 /** … … 271 281 * communicates over 272 282 */ 273 BaseCommunication &bc;283 BaseCommunication* bc; 274 284 275 285 /** -
source/ariba/utility/system/StartupWrapper.cpp
r2801 r3041 124 124 void StartupWrapper::startup(StartupInterface* service, bool block){ 125 125 126 StartupWrapper* s povnet= new StartupWrapper(service, block);126 StartupWrapper* startup = new StartupWrapper(service, block); 127 127 128 128 #ifdef UNDERLAY_OMNET 129 129 SystemQueue::instance().scheduleEvent( 130 SystemEvent( s povnet, StartupWrapperEventType, NULL), 0 );130 SystemEvent( startup, StartupWrapperEventType, NULL), 0 ); 131 131 #else 132 spovnet->handleSystemEvent( 133 SystemEvent( spovnet, StartupWrapperEventType, NULL)); 132 SystemQueue::instance().scheduleEvent( 133 SystemEvent( startup, StartupWrapperEventType, NULL), 0 ); 134 135 if( block ) getchar(); 134 136 #endif 135 137 } … … 149 151 150 152 service->startup(); 151 waitForExit();152 153 #ifndef UNDERLAY_OMNET154 service->shutdown();155 delete event.getListener();156 #endif157 153 } 158 154 159 void StartupWrapper::waitForExit(){ 160 #ifndef UNDERLAY_OMNET 161 if( blocking ) getchar(); 162 #endif 163 } 164 165 void StartupWrapper::shutdown(){ 155 void StartupWrapper::shutdown(StartupInterface* service){ 166 156 #ifdef UNDERLAY_OMNET 167 157 //TODO: service->shutdown(); 168 158 #endif 169 159 160 service->shutdown(); 170 161 SystemQueue::instance().cancel(); 171 162 } -
source/ariba/utility/system/StartupWrapper.h
r3040 r3041 72 72 static void initConfig(string filename); 73 73 static void startup(StartupInterface* service, bool block = true); 74 static void shutdown( );74 static void shutdown(StartupInterface* service); 75 75 76 76 #ifdef UNDERLAY_OMNET
Note:
See TracChangeset
for help on using the changeset viewer.