Changeset 5316 for source/ariba/overlay/modules
- Timestamp:
- Jul 24, 2009, 8:53:41 PM (15 years ago)
- Location:
- source/ariba/overlay/modules
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/modules/OverlayInterface.h
r5151 r5316 149 149 * @return The list of all known nodes 150 150 */ 151 virtual NodeList getKnownNodes( ) const = 0;151 virtual NodeList getKnownNodes(bool deep = true) const = 0; 152 152 153 153 /** -
source/ariba/overlay/modules/chord/Chord.cpp
r5151 r5316 61 61 stabilize_counter = 0; 62 62 stabilize_finger = 0; 63 bootstrapLink = LinkID::UNSPECIFIED;64 63 } 65 64 … … 112 111 void Chord::joinOverlay(const EndpointDescriptor& boot) { 113 112 logging_info( "joining Chord overlay structure through end-point " << 114 (boot == EndpointDescriptor::UNSPECIFIED ? 115 "local" : boot.toString()) ); 113 (boot.isUnspecified() ? "local" : boot.toString()) ); 116 114 117 115 // initiator? no->setup first link 118 if (! (boot == EndpointDescriptor::UNSPECIFIED))119 bootstrapLink = setup(boot);116 if (!boot.isUnspecified()) 117 bootstrapLinks.push_back( setup(boot) ); 120 118 121 119 // timer for stabilization management … … 176 174 } 177 175 178 OverlayInterface::NodeList Chord::getKnownNodes( ) const {176 OverlayInterface::NodeList Chord::getKnownNodes(bool deep) const { 179 177 OverlayInterface::NodeList nodelist; 180 for (size_t i = 0; i < table->size(); i++) 181 if ((*table)[i]->ref_count != 0 182 && !(*table)[i]->info.isUnspecified()) 183 nodelist.push_back((*table)[i]->id); 178 179 if( deep ){ 180 // all nodes that I know, fingers, succ/pred 181 for (size_t i = 0; i < table->size(); i++){ 182 if ((*table)[i]->ref_count != 0 183 && !(*table)[i]->info.isUnspecified()) 184 nodelist.push_back((*table)[i]->id); 185 } 186 } else { 187 // only succ and pred 188 if( table->get_predesessor() != NULL ) 189 nodelist.push_back( *(table->get_predesessor()) ); 190 191 if( table->get_successor() != NULL ) 192 nodelist.push_back( *(table->get_successor()) ); 193 } 194 184 195 return nodelist; 185 196 } … … 208 219 } 209 220 210 if (!bootstrapLink.isUnspecified() && lnk == bootstrapLink) { 221 vector<LinkID>::iterator it = std::find(bootstrapLinks.begin(), bootstrapLinks.end(), lnk); 222 if( it != bootstrapLinks.end() ) { 211 223 send_discovery_to(nodeid); 212 bootstrapLink = LinkID::UNSPECIFIED;224 bootstrapLinks.erase( it ); 213 225 } 214 226 } -
source/ariba/overlay/modules/chord/Chord.h
r5151 r5316 76 76 int stabilize_counter; 77 77 int stabilize_finger; 78 LinkID bootstrapLink;78 vector<LinkID> bootstrapLinks; 79 79 vector<NodeID> pending; 80 80 … … 120 120 121 121 /// @see OverlayInterface.h 122 virtual NodeList getKnownNodes( ) const;122 virtual NodeList getKnownNodes(bool deep = true) const; 123 123 124 124 /// @see CommunicationListener.h or @see OverlayInterface.h -
source/ariba/overlay/modules/onehop/OneHop.cpp
r5151 r5316 52 52 OverlayStructureEvents* _eventsReceiver, const OverlayParameterSet& param) 53 53 : OverlayInterface( _baseoverlay, _nodeid, _eventsReceiver, param ), 54 state ( OneHopStateInvalid ), 55 bootstrapLink ( LinkID::UNSPECIFIED ), 56 pendingLinks ( 0 ) { 54 state( OneHopStateInvalid ) { 57 55 58 56 // … … 88 86 logging_debug( "routing message to node " << destnode.toString() ); 89 87 88 // msg for ourselfs 89 if(destnode == nodeid) 90 baseoverlay.incomingRouteMessage( msg, LinkID::UNSPECIFIED, nodeid ); 91 92 // msg for other node 90 93 OverlayNodeMapping::const_iterator i = overlayNodes.find( destnode ); 91 94 if (i == overlayNodes.end()) { … … 116 119 // the create and join process is completed now. 117 120 logging_info( "creating onehop overlay structure" ); 118 state = OneHopStateCompleted;119 121 } 120 122 … … 123 125 logging_info( "deleting onehop overlay structure" ); 124 126 state = OneHopStateInvalid; 125 pendingLinks = 0; 126 } 127 128 OverlayInterface::NodeList OneHop::getKnownNodes() const { 127 } 128 129 OverlayInterface::NodeList OneHop::getKnownNodes(bool deep) const { 129 130 130 131 OverlayInterface::NodeList retlist; … … 142 143 143 144 logging_info( "joining onehop overlay structure through end-point " << 144 (bootstrapEp == EndpointDescriptor::UNSPECIFIED ? 145 "local" : bootstrapEp.toString()) ); 146 147 state = OneHopStateJoinInitiated; 148 pendingLinks = 0; 149 150 if( bootstrapEp == EndpointDescriptor::UNSPECIFIED ){ 145 (bootstrapEp.isUnspecified() ? "local" : bootstrapEp.toString()) ); 146 147 if( bootstrapEp.isUnspecified() ){ 151 148 152 149 // we are the initiator and we are to bootstrap against … … 156 153 state = OneHopStateCompleted; 157 154 } else { 158 bootstrapLink = baseoverlay.establishLink( bootstrapEp, 159 OverlayInterface::OVERLAY_SERVICE_ID ); 155 bootstrapLinks.push_back( 156 baseoverlay.establishLink( bootstrapEp, 157 OverlayInterface::OVERLAY_SERVICE_ID ) 158 ); 160 159 } 161 160 } … … 187 186 } 188 187 } 189 190 pendingLinks = 0;191 188 } 192 189 … … 210 207 } 211 208 } 209 210 vector<LinkID>::iterator it = std::find( bootstrapLinks.begin(), bootstrapLinks.end(), lnk ); 211 if( it != bootstrapLinks.end() ) bootstrapLinks.erase( it ); 212 212 } 213 213 214 214 void OneHop::onLinkUp(const LinkID& lnk, const NodeID& remote){ 215 216 //217 // as soon as a link goes up, we always request the node listing.218 // and try to get connections to as much nodes as possible in a greedy way.219 //220 221 if( lnk != bootstrapLink ){222 if( pendingLinks > 0 ) pendingLinks--;223 if( pendingLinks == 0 ) state = OneHopStateCompleted;224 }225 215 226 216 logging_debug( "link is up, sending out node listing request" ); … … 230 220 onemsg.encapsulate( &requestmsg ); 231 221 232 state = OneHopStateJoinListingRequested;233 222 baseoverlay.sendMessage( &onemsg, lnk ); 234 223 } … … 309 298 const NodeListingReply::NodeEndpointList& endpoints = reply->getList(); 310 299 logging_debug( "received " << endpoints.size() << " nodes in listing" ); 311 pendingLinks = 0;312 300 313 301 NodeListingReply::NodeEndpointList::const_iterator i = endpoints.begin(); … … 330 318 331 319 overlayNodes.insert( make_pair(node, link) ); 332 pendingLinks++;333 320 334 321 } // for( ; i != iend; i++ ) … … 356 343 if( onemsg->isType( OneHopMessage::OneHopMessageTypeRoute) ){ 357 344 logging_debug( "Route message arrived at destination node -> delegate to BaseOverlay" ); 358 baseoverlay.incomingRouteMessage( onemsg 345 baseoverlay.incomingRouteMessage( onemsg, lnk, remote); 359 346 } // OneHopMessageTypeRoute 360 347 -
source/ariba/overlay/modules/onehop/OneHop.h
r5151 r5316 90 90 91 91 /// @see OverlayInterface.h 92 virtual NodeList getKnownNodes( ) const;92 virtual NodeList getKnownNodes(bool deep = true) const; 93 93 94 94 /// @see CommunicationListener.h or @see OverlayInterface.h … … 110 110 typedef enum _OneHopState { 111 111 OneHopStateInvalid = 0, 112 OneHopStateJoinInitiated = 1, 113 OneHopStateJoinListingRequested = 2, 114 OneHopStateCompleted = 3, 112 OneHopStateCompleted = 1, 115 113 } OneHopState; 116 114 117 115 OneHopState state; 118 uint16_t pendingLinks; 119 LinkID bootstrapLink; 116 vector<LinkID> bootstrapLinks; 120 117 }; 121 118
Note:
See TracChangeset
for help on using the changeset viewer.