Changeset 3037 for source/ariba/overlay
- Timestamp:
- Apr 22, 2009, 9:07:53 PM (16 years ago)
- Location:
- source/ariba/overlay
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/BaseOverlay.cpp
r2803 r3037 107 107 108 108 logging_info( "leaving spovnet " << spovnetId ); 109 bool ret = ( state != this->BaseOverlayStateInvalid ); 109 110 110 111 logging_debug( "dropping all auto-links ..." ); 111 112 112 113 BOOST_FOREACH( LinkPair item, linkMapping ){ 113 if( item.second.autolink ) 114 if( item.second.autolink ) 114 115 dropLink( item.first ); 115 116 } … … 135 136 // inform all registered services of the event 136 137 BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){ 137 i->onOverlayDestroy( spovnetId ); 138 if( ret ) i->onLeaveSuccess( spovnetId ); 139 else i->onLeaveFail( spovnetId ); 138 140 } 139 141 } … … 159 161 160 162 // 161 // create the overlay162 //163 164 overlayInterface->createOverlay();165 BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){166 i->onOverlayCreate( spovnetId );167 }168 169 //170 163 // bootstrap against ourselfs 171 164 // … … 286 279 node.toString() << " for service " << service.toString() << 287 280 ". creating auto link ..."); 288 281 289 282 const LinkID link = establishLink( node, service ); 290 283 LinkMapping::iterator i = linkMapping.find( link ); … … 328 321 ServiceInterface* iface = listenerMux.get( sid ); 329 322 listenerMux.unregisterItem( sid ); 330 323 331 324 return NULL; //iface; 332 325 } … … 385 378 " on link " << id.toString() ); 386 379 387 OverlayMsg overMsg( 388 OverlayMsg::OverlayMessageTypeUpdate, 389 i->second.service, 390 nodeId 380 OverlayMsg overMsg( 381 OverlayMsg::OverlayMessageTypeUpdate, 382 i->second.service, 383 nodeId 391 384 ); 392 385 … … 655 648 656 649 overlayInterface->createOverlay(); 657 658 // inform all registered services of the event659 BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){660 i->onOverlayCreate( spovnetId );661 }662 663 650 overlayInterface->joinOverlay( replyMsg->getBootstrapEndpoint() ); 664 651 … … 765 752 // inform all registered services of the event 766 753 BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){ 767 i->on OverlayDestroy( spovnetId );754 i->onLeaveFail( spovnetId ); 768 755 } 769 756 … … 815 802 sendMessage( message, *i, service ); // TODO: sollte auto links aufbauen fÃŒr sowas 816 803 } 804 } 805 806 vector<NodeID> BaseOverlay::getOverlayNeighbors() const { 807 // the known nodes _can_ also include our 808 // node, so we remove ourselfs 809 810 vector<NodeID> nodes = overlayInterface->getKnownNodes(); 811 vector<NodeID>::iterator i = find( nodes.begin(), nodes.end(), this->nodeId ); 812 if( i != nodes.end() ) nodes.erase( i ); 813 814 return nodes; 817 815 } 818 816 -
source/ariba/overlay/BaseOverlay.h
r2803 r3037 44 44 #include <algorithm> 45 45 #include <ctime> 46 #include <list> 47 #include <vector> 46 48 #include <boost/foreach.hpp> 47 49 … … 66 68 #include "ariba/overlay/messages/JoinReply.h" 67 69 70 using std::vector; 71 using std::list; 68 72 using std::cout; 69 73 using std::map; 70 74 using std::make_pair; 71 75 using std::pair; 76 using std::find; 72 77 73 78 using ariba::communication::EndpointDescriptor; … … 103 108 // in different namespace 104 109 namespace ariba { 105 namespace interface { 106 class UnderlayAbstraction; 107 }} 110 class Node; 111 } 108 112 109 113 namespace ariba { … … 117 121 118 122 use_logging_h( BaseOverlay ); 119 friend class ariba:: interface::UnderlayAbstraction;123 friend class ariba::Node; 120 124 121 125 public: … … 166 170 const ServiceID& service 167 171 ); 172 173 /** 174 * Get a list of overlay neighboring nodes. 175 */ 176 vector<NodeID> getOverlayNeighbors() const; 168 177 169 178 /** … … 324 333 static const LinkItem UNSPECIFIED; 325 334 326 LinkItem( const LinkID& _link, const NodeID& _node, 335 LinkItem( const LinkID& _link, const NodeID& _node, 327 336 const ServiceID& _service, ServiceInterface* _interface ) 328 : link( _link ), node( _node ), service( _service ), interface( _interface ), 337 : link( _link ), node( _node ), service( _service ), interface( _interface ), 329 338 autolink( false ), lastuse( time(NULL) ) { 330 339 } … … 350 359 typedef pair<const LinkID,LinkItem> LinkPair; 351 360 LinkMapping linkMapping; 352 361 353 362 // nodes with pending joines. TODO: should be cleaned every some seconds 354 363 // add timestamps to each, and check on occasion -
source/ariba/overlay/OverlayEvents.cpp
r3036 r3037 48 48 } 49 49 50 void OverlayEvents::onOverlayCreate( const SpoVNetID& id ){51 }52 53 void OverlayEvents::onOverlayDestroy( const SpoVNetID& id ){54 }55 56 50 bool OverlayEvents::isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid ){ 57 51 // default: allow all nodes to join … … 71 65 } 72 66 67 void OverlayEvents::onLeaveSuccess( const SpoVNetID& spovnetid ){ 68 } 69 70 void OverlayEvents::onLeaveFail( const SpoVNetID& spovnetid ){ 71 } 72 73 73 void OverlayEvents::onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote ){ 74 74 } -
source/ariba/overlay/OverlayEvents.h
r3036 r3037 58 58 59 59 protected: 60 61 virtual void onOverlayCreate( const SpoVNetID& id );62 virtual void onOverlayDestroy( const SpoVNetID& id );63 64 60 /// for initiator about remote nodes 65 61 virtual bool isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid ); … … 70 66 virtual void onJoinSuccess( const SpoVNetID& spovnetid ); 71 67 virtual void onJoinFail( const SpoVNetID& spovnetid ); 68 virtual void onLeaveSuccess( const SpoVNetID& spovnetid ); 69 virtual void onLeaveFail( const SpoVNetID& spovnetid ); 72 70 73 71 virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
Note:
See TracChangeset
for help on using the changeset viewer.