Changeset 4839 for source/ariba/overlay
- Timestamp:
- Jul 9, 2009, 3:41:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/BaseOverlay.cpp
r4838 r4839 106 106 } 107 107 108 void BaseOverlay::joinSpoVNet(const SpoVNetID& id, const EndpointDescriptor& bootstrapEp){109 110 ovl.visShowNodeBubble ( ovlId, nodeId, "joining..." );111 logging_info( "starting to join spovnet " << id.toString() <<112 " with nodeid " << nodeId.toString());113 114 spovnetId = id;115 state = BaseOverlayStateJoinInitiated;116 117 //118 // start bootstrapping for spovnetid119 //120 121 overlayBootstrap.start( this, spovnetId, nodeId );122 overlayBootstrap.publish( bc->getEndpointDescriptor() );123 124 //125 // contact the spovnet initiator and request126 // to join. if the join is granted we will127 // receive further information on the structure128 // of the overlay that is used in the spovnet129 //130 // but first, we have to establish a link to the initiator...131 //132 133 initiatorLink = bc->establishLink( bootstrapEp );134 logging_info("join process initiated for " << id.toString() << "...");135 }136 137 void BaseOverlay::leaveSpoVNet(){138 139 logging_info( "leaving spovnet " << spovnetId );140 bool ret = ( state != this->BaseOverlayStateInvalid );141 142 logging_debug( "dropping all auto-links ..." );143 144 // now we start leaving the spovnet: fist delete all links145 // that we still have in the baseoverlay initiated by146 // some services, the leave the actual overlay structure,147 // then leave the spovnet148 149 // --> drop all service links150 151 vector<LinkID> servicelinks;152 BOOST_FOREACH( LinkPair item, linkMapping ){153 if( item.second.service != OverlayInterface::OVERLAY_SERVICE_ID )154 servicelinks.push_back( item.first );155 }156 BOOST_FOREACH( LinkID lnk, servicelinks ){157 // the dropLink function will remove158 // the item from the linkMapping159 dropLink( lnk );160 }161 162 // --> leave overlay structure163 164 logging_debug( "leaving overlay" );165 // first, leave the overlay interface166 if( overlayInterface != NULL )167 overlayInterface->leaveOverlay();168 169 // --> leave spovnet170 171 if( state != BaseOverlayStateInitiator ){172 173 // then, leave the spovnet baseoverlay174 OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeBye, nodeId );175 bc->sendMessage( initiatorLink, &overMsg );176 177 // drop the link and set to correct state178 bc->dropLink( initiatorLink );179 initiatorLink = LinkID::UNSPECIFIED;180 }181 182 state = BaseOverlayStateInvalid;183 ovl.visShutdown( ovlId, nodeId, string("") );184 185 // inform all registered services of the event186 BOOST_FOREACH( NodeListener* i, nodeListeners ){187 if( ret ) i->onLeaveCompleted( spovnetId );188 else i->onLeaveFailed( spovnetId );189 }190 }191 192 108 void BaseOverlay::createSpoVNet(const SpoVNetID& id, const OverlayParameterSet& param, const SecurityParameterSet& sec, const QoSParameterSet& qos){ 193 109 … … 216 132 } 217 133 134 void BaseOverlay::joinSpoVNet(const SpoVNetID& id, const EndpointDescriptor& bootstrapEp){ 135 136 ovl.visShowNodeBubble ( ovlId, nodeId, "joining..." ); 137 logging_info( "starting to join spovnet " << id.toString() << 138 " with nodeid " << nodeId.toString()); 139 140 spovnetId = id; 141 state = BaseOverlayStateJoinInitiated; 142 143 // 144 // start bootstrapping for spovnets and publish our information 145 // 146 147 overlayBootstrap.start( this, spovnetId, nodeId ); 148 overlayBootstrap.publish( bc->getEndpointDescriptor() ); 149 150 // 151 // contact the spovnet initiator and request 152 // to join. if the join is granted we will 153 // receive further information on the structure 154 // of the overlay that is used in the spovnet 155 // 156 // but first, we have to establish a link to the initiator... 157 // 158 159 initiatorLink = bc->establishLink( bootstrapEp ); 160 logging_info("join process initiated for " << id.toString() << "..."); 161 } 162 163 void BaseOverlay::leaveSpoVNet(){ 164 165 logging_info( "leaving spovnet " << spovnetId ); 166 bool ret = ( state != this->BaseOverlayStateInvalid ); 167 168 logging_debug( "dropping all auto-links ..." ); 169 170 // now we start leaving the spovnet: fist delete all links 171 // that we still have in the baseoverlay initiated by 172 // some services, the leave the actual overlay structure, 173 // then leave the spovnet 174 175 // --> drop all service links 176 177 vector<LinkID> servicelinks; 178 BOOST_FOREACH( LinkPair item, linkMapping ){ 179 if( item.second.service != OverlayInterface::OVERLAY_SERVICE_ID ) 180 servicelinks.push_back( item.first ); 181 } 182 BOOST_FOREACH( LinkID lnk, servicelinks ){ 183 // the dropLink function will remove 184 // the item from the linkMapping 185 dropLink( lnk ); 186 } 187 188 // --> leave overlay structure 189 190 logging_debug( "leaving overlay" ); 191 // first, leave the overlay interface 192 if( overlayInterface != NULL ) 193 overlayInterface->leaveOverlay(); 194 195 // --> leave spovnet 196 197 if( state != BaseOverlayStateInitiator ){ 198 199 // then, leave the spovnet baseoverlay 200 OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeBye, nodeId ); 201 bc->sendMessage( initiatorLink, &overMsg ); 202 203 // drop the link and set to correct state 204 bc->dropLink( initiatorLink ); 205 initiatorLink = LinkID::UNSPECIFIED; 206 } 207 208 state = BaseOverlayStateInvalid; 209 ovl.visShutdown( ovlId, nodeId, string("") ); 210 211 // inform all registered services of the event 212 BOOST_FOREACH( NodeListener* i, nodeListeners ){ 213 if( ret ) i->onLeaveCompleted( spovnetId ); 214 else i->onLeaveFailed( spovnetId ); 215 } 216 } 218 217 219 218 /// establishes a link between two arbitrary nodes
Note:
See TracChangeset
for help on using the changeset viewer.