Changeset 3041 for source/ariba/overlay
- Timestamp:
- Apr 23, 2009, 9:18:12 AM (16 years ago)
- Location:
- source/ariba/overlay
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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 /**
Note:
See TracChangeset
for help on using the changeset viewer.