Changeset 5316 for source/ariba/overlay/modules/onehop
- Timestamp:
- Jul 24, 2009, 8:53:41 PM (15 years ago)
- Location:
- source/ariba/overlay/modules/onehop
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.