Changeset 5316 for source/ariba/overlay/modules/chord
- Timestamp:
- Jul 24, 2009, 8:53:41 PM (15 years ago)
- Location:
- source/ariba/overlay/modules/chord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.