Changeset 4839 for source/ariba


Ignore:
Timestamp:
Jul 9, 2009, 3:41:19 PM (15 years ago)
Author:
Christoph Mayer
Message:
 
Location:
source/ariba
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/BaseOverlay.cpp

    r4838 r4839  
    106106}
    107107
    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 spovnetid
    119         //
    120 
    121         overlayBootstrap.start( this, spovnetId, nodeId );
    122         overlayBootstrap.publish( bc->getEndpointDescriptor() );
    123 
    124         //
    125         // contact the spovnet initiator and request
    126         // to join. if the join is granted we will
    127         // receive further information on the structure
    128         // of the overlay that is used in the spovnet
    129         //
    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 links
    145         // that we still have in the baseoverlay initiated by
    146         // some services, the leave the actual overlay structure,
    147         // then leave the spovnet
    148 
    149         // --> drop all service links
    150 
    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 remove
    158                 // the item from the linkMapping
    159                 dropLink( lnk );
    160         }
    161 
    162         // --> leave overlay structure
    163 
    164         logging_debug( "leaving overlay" );
    165         // first, leave the overlay interface
    166         if( overlayInterface != NULL )
    167                 overlayInterface->leaveOverlay();
    168 
    169         // --> leave spovnet
    170 
    171         if( state != BaseOverlayStateInitiator ){
    172 
    173                 // then, leave the spovnet baseoverlay
    174                 OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeBye, nodeId );
    175                 bc->sendMessage( initiatorLink, &overMsg );
    176 
    177                 // drop the link and set to correct state
    178                 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 event
    186         BOOST_FOREACH( NodeListener* i, nodeListeners ){
    187                 if( ret ) i->onLeaveCompleted( spovnetId );
    188                 else      i->onLeaveFailed( spovnetId );
    189         }
    190 }
    191 
    192108void BaseOverlay::createSpoVNet(const SpoVNetID& id, const OverlayParameterSet& param, const SecurityParameterSet& sec, const QoSParameterSet& qos){
    193109
     
    216132}
    217133
     134void 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
     163void 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}
    218217
    219218/// establishes a link between two arbitrary nodes
  • source/ariba/utility/system/Timer.h

    r4828 r4839  
    8585        /**
    8686         * Reset a running timer and ignore the remaining interval
    87          * time. Start the timer with a new timer interval.
     87         * time. Does not fire the timer event and start the timer
     88         * with a new interval.
    8889         */
    8990        void reset();
Note: See TracChangeset for help on using the changeset viewer.