Changeset 3067 for source/ariba
- Timestamp:
- Apr 24, 2009, 10:04:11 AM (16 years ago)
- Location:
- source/ariba
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/Node.cpp
r3055 r3067 138 138 } 139 139 140 voidNode::bind(NodeListener* listener) {141 base_overlay->bind(listener);142 } 143 144 voidNode::unbind(NodeListener* listener) {145 base_overlay->unbind(listener);146 } 147 148 voidNode::bind(CommunicationListener* listener, const ServiceID& sid) {149 base_overlay->bind(listener, sid);150 } 151 152 voidNode::unbind(CommunicationListener* listener, const ServiceID& sid) {153 base_overlay->unbind(listener, sid);140 bool Node::bind(NodeListener* listener) { 141 return base_overlay->bind(listener); 142 } 143 144 bool Node::unbind(NodeListener* listener) { 145 return base_overlay->unbind(listener); 146 } 147 148 bool Node::bind(CommunicationListener* listener, const ServiceID& sid) { 149 return base_overlay->bind(listener, sid); 150 } 151 152 bool Node::unbind(CommunicationListener* listener, const ServiceID& sid) { 153 return base_overlay->unbind(listener, sid); 154 154 } 155 155 -
source/ariba/Node.h
r3055 r3067 122 122 * 123 123 * @param listener The node listener 124 */ 125 void bind(NodeListener* listener); 124 * @return boolean indicating success of failure 125 */ 126 bool bind(NodeListener* listener); 126 127 127 128 /** … … 129 130 * 130 131 * @param listener The node listener 131 */ 132 void unbind(NodeListener* listener); 132 * @return boolean indicating success of failure 133 */ 134 bool unbind(NodeListener* listener); 133 135 134 136 //--- spovnet properties --- … … 266 268 * @param listener The listener to be registered 267 269 * @param sid The service identifier 268 */ 269 void bind(CommunicationListener* listener, const ServiceID& sid); 270 * @return boolean indicating success of failure 271 */ 272 bool bind(CommunicationListener* listener, const ServiceID& sid); 270 273 271 274 /** … … 273 276 * 274 277 * @param The listener to be unbound 275 */ 276 void unbind(CommunicationListener* listener, const ServiceID& sid); 277 278 // --- extension proposal: service directory -- TODO 278 * @return boolean indicating success of failure 279 */ 280 bool unbind(CommunicationListener* listener, const ServiceID& sid); 281 282 // --- extension proposal: service directory -- 279 283 // main-idea: use this methods to register groups/rendevous points inside 280 284 // the base overlay via a distributed storage service. -
source/ariba/communication/BaseCommunication.cpp
r3037 r3067 457 457 logging_debug( "the link is now up with local link id " << spovmsg->getRemoteLink().toString() ); 458 458 459 // notify the baseoverlay that the link is up, so 460 // it can exchange nodeids over this link. then we 461 // can send the queued messages, as both nodes have 462 // to know their nodeids first 463 459 464 BOOST_FOREACH( CommunicationEvents* i, eventListener ){ 460 465 i->onLinkUp( linkDesc.localLink, linkDesc.localLocator, linkDesc.remoteLocator ); -
source/ariba/overlay/BaseOverlay.cpp
r3056 r3067 123 123 logging_debug( "dropping all auto-links ..." ); 124 124 125 // now we start leaving the spovnet: fist delete all links 126 // that we still have in the baseoverlay initiated by 127 // some services, the leave the actual overlay structure, 128 // then leave the spovnet 129 130 // --> drop all service links 131 132 vector<LinkID> servicelinks; 125 133 BOOST_FOREACH( LinkPair item, linkMapping ){ 126 if( item.second.autolink ) 127 dropLink( item.first ); 128 } 134 if( item.second.service != OverlayInterface::OVERLAY_SERVICE_ID ) 135 servicelinks.push_back( item.first ); 136 } 137 BOOST_FOREACH( LinkID lnk, servicelinks ){ 138 // the dropLink function will remove 139 // the item from the linkMapping 140 dropLink( lnk ); 141 } 142 143 // --> leave overlay structure 129 144 130 145 logging_debug( "leaving overlay" ); 131 146 // first, leave the overlay interface 132 147 overlayInterface->leaveOverlay(); 148 149 // --> leave spovnet 133 150 134 151 if( state != BaseOverlayStateInitiator ){ … … 185 202 } 186 203 187 const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const LinkID& link) const {188 189 return bc->getEndpointDescriptor( link );190 }191 192 const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const NodeID& node) const {193 194 if( node == nodeId || node == NodeID::UNSPECIFIED )195 return bc->getEndpointDescriptor();196 197 if( overlayInterface == NULL ){198 logging_error( "overlay interface not set, cannot resolve endpoint" );199 return EndpointDescriptor::UNSPECIFIED;200 }201 202 // TODO: if this is not a onehop overlay the operation will go asynchronously203 return overlayInterface->resolveNode( node );204 }205 206 204 const LinkID BaseOverlay::establishLink(const NodeID& node, const ServiceID& service){ 207 205 … … 227 225 } 228 226 227 const LinkID link = bc->establishLink( ep ); 228 229 229 CommunicationListener* receiver = communicationListeners.get( service ); 230 const LinkID link = bc->establishLink( ep );231 232 230 LinkItem item (link, NodeID::UNSPECIFIED, service, receiver); 233 231 linkMapping.insert( make_pair(link, item) ); … … 292 290 ". creating auto link ..."); 293 291 294 const LinkIDlink = establishLink( node, service );292 link = establishLink( node, service ); 295 293 LinkMapping::iterator i = linkMapping.find( link ); 296 294 297 if( i == linkMapping.end() ){295 if( i == linkMapping.end() || link == LinkID::UNSPECIFIED ){ 298 296 logging_error( "failed to establish auto link to node " << node.toString() << 299 297 " for service " << service.toString() ); … … 303 301 i->second.autolink = true; 304 302 303 logging_debug( "establishing autolink in progress to node " 304 << node.toString() << " with new link-id " << link.toString() ); 305 305 306 } // if( link != LinkID::UNSPECIFIED ) 306 307 308 assert( link != LinkID::UNSPECIFIED ); 309 310 // mark the link as used, as we 311 // now send a message through it 307 312 i->second.markused(); 313 314 // send the message through the new link. the link may not be functional, 315 // but for us there is a link-id so we can send messages through it. if 316 // the link is not yet up and the message needs to be cached, this is the 317 // task of the BaseCommunication, it will cache and send it later. 308 318 return sendMessage( message, link ); 309 319 } 310 320 311 void BaseOverlay::bind(CommunicationListener* listener, const ServiceID& sid){ 321 const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const LinkID& link) const { 322 323 return bc->getEndpointDescriptor( link ); 324 } 325 326 const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const NodeID& node) const { 327 328 if( node == nodeId || node == NodeID::UNSPECIFIED ) 329 return bc->getEndpointDescriptor(); 330 331 if( overlayInterface == NULL ){ 332 logging_error( "overlay interface not set, cannot resolve endpoint" ); 333 return EndpointDescriptor::UNSPECIFIED; 334 } 335 336 // TODO: if this is not a onehop overlay the operation will go asynchronously 337 return overlayInterface->resolveNode( node ); 338 } 339 340 bool BaseOverlay::bind(CommunicationListener* listener, const ServiceID& sid){ 312 341 logging_debug( "binding communication listener " << listener 313 342 << " on serviceid " << sid.toString() ); … … 316 345 logging_error( "some listener already registered for service id " 317 346 << sid.toString() ); 318 return ;347 return false; 319 348 } 320 349 321 350 communicationListeners.registerItem( listener, sid ); 322 } 323 324 void BaseOverlay::unbind(CommunicationListener* listener, const ServiceID& sid){ 351 return true; 352 } 353 354 bool BaseOverlay::unbind(CommunicationListener* listener, const ServiceID& sid){ 325 355 logging_debug( "unbinding listener " << listener 326 356 << " from serviceid " << sid.toString() ); … … 328 358 if( !communicationListeners.contains( sid ) ){ 329 359 logging_warn( "cannot unbind listener. no listener registered on service id " << sid.toString() ); 330 return ;360 return false; 331 361 } 332 362 … … 334 364 logging_warn( "listener bound to service id " << sid.toString() 335 365 << " is different than listener trying to unbind" ); 336 return ;366 return false; 337 367 } 338 368 339 369 communicationListeners.unregisterItem( sid ); 340 } 341 342 void BaseOverlay::bind(NodeListener* listener){ 370 return true; 371 } 372 373 bool BaseOverlay::bind(NodeListener* listener){ 343 374 logging_debug( "binding node listener " << listener ); 344 375 … … 346 377 if( i != nodeListeners.end() ){ 347 378 logging_warn( "node listener " << listener << " is already bound, cannot bind" ); 348 return ;379 return false; 349 380 } 350 381 351 382 nodeListeners.push_back( listener ); 352 } 353 354 void BaseOverlay::unbind(NodeListener* listener){ 383 return true; 384 } 385 386 bool BaseOverlay::unbind(NodeListener* listener){ 355 387 logging_debug( "unbinding node listener " << listener ); 356 388 … … 358 390 if( i == nodeListeners.end() ){ 359 391 logging_warn( "node listener " << listener << " is not bound, cannot unbind" ); 360 return ;392 return false; 361 393 } 362 394 363 395 nodeListeners.erase( i ); 396 return true; 364 397 } 365 398 … … 445 478 if( i == linkMapping.end() ) { 446 479 // this can also be one of the baseoverlay links that 447 // no mapping is stored for. therefore we issue no warning 480 // no mapping is stored for. therefore we issue no warning. 481 // it can also be a link that has been dropped and the 482 // mapping is already deleted in the dropLink function. 483 // also, the service notification is issued then in dropLink 448 484 return; 449 485 } -
source/ariba/overlay/BaseOverlay.h
r3056 r3067 202 202 * TODO 203 203 */ 204 voidbind(CommunicationListener* listener, const ServiceID& sid);205 206 /** 207 * TODO 208 */ 209 voidunbind(CommunicationListener* listener, const ServiceID& sid);210 211 /** 212 * TODO 213 */ 214 voidbind(NodeListener* listener);215 216 /** 217 * TODO 218 */ 219 voidunbind(NodeListener* listener);204 bool bind(CommunicationListener* listener, const ServiceID& sid); 205 206 /** 207 * TODO 208 */ 209 bool unbind(CommunicationListener* listener, const ServiceID& sid); 210 211 /** 212 * TODO 213 */ 214 bool bind(NodeListener* listener); 215 216 /** 217 * TODO 218 */ 219 bool unbind(NodeListener* listener); 220 220 221 221 /** -
source/ariba/overlay/modules/OverlayInterface.h
r3057 r3067 58 58 59 59 class OverlayInterface : public CommunicationListener { 60 friend class BaseOverlay; 60 61 public: 61 62 OverlayInterface( -
source/ariba/overlay/modules/onehop/OneHop.cpp
r3057 r3067 146 146 logging_info( "leaving onehop overlay structure" ); 147 147 148 // set the state to invalid, this will prevent from 149 // handling onLinkDown events, as we are traversing the 150 // overlayNodes map and the onLinkDown function is called 151 // from the BaseOverlay and OneHop::onLinkDown will also 152 // try to access the overlayNodes structure. 153 state = OneHopStateInvalid; 154 148 155 // 149 156 // close all links, this will indicate the other nodes that we left … … 158 165 } 159 166 160 state = OneHopStateInvalid;161 167 pendingLinks = 0; 162 168 } … … 164 170 165 171 void OneHop::onLinkDown(const LinkID& lnk, const NodeID& remote){ 172 173 // don't handle when we are in state-invalid, 174 // see comment in OneHop::leaveOverlay 175 if( state == OneHopStateInvalid ) return; 166 176 167 177 // -
source/ariba/utility/system/StartupWrapper.cpp
r3041 r3067 103 103 { 104 104 log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger()); 105 logger->setLevel(log4cxx::Level::get Debug());105 logger->setLevel(log4cxx::Level::getInfo()); 106 106 } 107 107
Note:
See TracChangeset
for help on using the changeset viewer.