Changeset 3705 for source


Ignore:
Timestamp:
May 26, 2009, 4:27:55 PM (15 years ago)
Author:
Christoph Mayer
Message:

-einige fixed bzgl. link management, fehlerhafte serialisierer, etc.

Location:
source/ariba
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/communication/EndpointDescriptor.cpp

    r3690 r3705  
    112112bool EndpointDescriptor::operator==(const EndpointDescriptor& rh) const {
    113113
    114         if( locator != NULL && rh.locator != NULL )
    115                 return ( locator->operator==(*rh.locator) );
     114        if( isUnspecified() && rh.isUnspecified() ) {
    116115
    117         if( locator != rh.locator )
     116                // both unspec bit set
     117                return true;
     118
     119        } else if( (!isUnspecified()) && (!rh.isUnspecified()) ) {
     120
     121                //
     122                // both are valid, check locators
     123                //
     124
     125                if( locator == NULL && rh.locator == NULL ){
     126
     127                        // both locators are invalid, ok true
     128                        return true;
     129
     130                } else if( locator == NULL ^ rh.locator == NULL ) {
     131
     132                        // one locator is invalid, the other not, false
     133                        return false;
     134
     135                } else {
     136
     137                        // both locators are valid, compare
     138                        assert( locator != NULL && rh.locator != NULL );
     139                        return ( locator->operator==(*rh.locator) );
     140
     141                }
     142
     143        } else {
     144
     145                // one is unspec, the other not
     146                assert( isUnspecified() ^ rh.isUnspecified() );
    118147                return false;
    119148
    120         return (isUnspec == rh.isUnspec);
     149        }
     150
    121151}
    122152
  • source/ariba/communication/EndpointDescriptor.h

    r3690 r3705  
    100100
    101101sznBeginDefault( ariba::communication::EndpointDescriptor, X ) {
    102         X && VO(locator);
     102        uint8_t unspec = isUnspec;
     103
     104        X && unspec && VO(locator);
     105
     106        // when deserializing reset unspec flag
     107        if (X.isDeserializer()) isUnspec = unspec;
    103108} sznEnd();
    104109
  • source/ariba/overlay/BaseOverlay.cpp

    r3699 r3705  
    820820                if( iface->onLinkRequest(sourcenode) ){
    821821
     822                        logging_debug("link " << link.toString() <<
     823                                        " has been accepted by service " << service.toString());
     824
    822825                        // call the notification functions
    823826                        iface->onLinkUp( link, sourcenode );
     
    825828
    826829                } else {
     830
     831                        logging_debug("link " << link.toString() <<
     832                                                                " has been denied by service " << service.toString() << ", dropping link");
     833
    827834                        // prevent onLinkDown calls to the service
    828835                        i->second.interface = &CommunicationListener::DEFAULT;
  • source/ariba/overlay/modules/OverlayInterface.cpp

    r3690 r3705  
    7575bool OverlayInterface::onLinkRequest(const NodeID& remote,
    7676                const DataMessage& msg) {
     77        return true;
    7778}
    7879
  • source/ariba/overlay/modules/onehop/OneHop.cpp

    r3690 r3705  
    5959        //
    6060        overlayNodes.insert( make_pair(_nodeid, LinkID::UNSPECIFIED) );
     61
     62        Timer::setInterval(5000);
     63        Timer::start();
    6164}
    6265
    6366OneHop::~OneHop(){
     67        Timer::stop();
    6468        deleteOverlay();
    6569}
     
    155159
    156160        //
    157         // close all links, this will indicate the other nodes that we left
     161        // send leave messages to all nodes. the nodes
     162        // will then drop the links
    158163        //
    159164
     
    162167
    163168        for( ; i != iend; i++){
    164                 if( i->first != nodeid && i->second != LinkID::UNSPECIFIED )
    165                         baseoverlay.dropLink( i->second );
     169                if( i->first != nodeid && i->second != LinkID::UNSPECIFIED ){
     170
     171                        OneHopMessage msg (OneHopMessage::OneHopMessageTypeLeave);
     172                        baseoverlay.sendMessage( &msg, i->second );
     173                }
    166174        }
    167175
     
    177185
    178186        // node went down, remove from overlay mapping
    179         logging_debug( "node " << remote.toString() << " left overlay structure" );
     187        logging_debug( "link " << lnk.toString() << " to node " << remote.toString() << " went down, removing node" );
    180188
    181189        OverlayNodeMapping::iterator i = overlayNodes.begin();
     
    266274                eventsReceiver->onNodeJoin( remote );
    267275
    268         } // if( request != NULL )
     276        } // OneHopMessageTypeListingRequest
    269277
    270278        //
     
    312320                } // for( ; i != iend; i++ )
    313321
    314         } // if( reply != NULL )
     322        } // OneHopMessageTypeListingReply
     323
     324        //
     325        // handle node leaves
     326        //
     327
     328        if( onemsg->isType(OneHopMessage::OneHopMessageTypeLeave) ){
     329
     330                logging_debug("received leave message from " <<
     331                                remote.toString() << " on link " << lnk.toString());
     332
     333                // drop the link to the node
     334                baseoverlay.dropLink( lnk );
     335
     336        } // OneHopMessageTypeLeave
     337
     338        //
     339        // handle kbr route messages
     340        //
    315341
    316342        if( onemsg->isType( OneHopMessage::OneHopMessageTypeRoute) ){
    317343                logging_debug( "Route message arrived at destination node -> delegate to BaseOverlay" );
    318344                baseoverlay.incomingRouteMessage( onemsg );
    319         }
    320 
     345        } // OneHopMessageTypeRoute
     346
     347}
     348
     349void OneHop::eventFunction(){
     350
     351        logging_debug("<<<<<<<<<<<<<<<<onehop-table<<<<<<<<<<<<<<<<<<<");
     352
     353                OverlayNodeMapping::iterator i = overlayNodes.begin();
     354                OverlayNodeMapping::iterator iend = overlayNodes.end();
     355
     356                for( ; i != iend; i++ ){
     357
     358                        const NodeID node = i->first;
     359                        const LinkID link = i->second;
     360                        const EndpointDescriptor& endpoint = baseoverlay.getEndpointDescriptor( link );
     361
     362                        logging_debug(  "node: " << node.toString() <<
     363                                                        ", link_: " << link.toString() << ", endp: " << endpoint.toString());
     364                }
     365
     366        logging_debug(">>>>>>>>>>>>>>>>>onehop-table>>>>>>>>>>>>>>>>>>>>>");
    321367
    322368}
  • source/ariba/overlay/modules/onehop/OneHop.h

    r3690 r3705  
    4343#include "ariba/overlay/modules/OverlayInterface.h"
    4444#include "ariba/utility/logging/Logging.h"
     45#include "ariba/utility/system/Timer.h"
    4546
    4647using std::map;
     48using ariba::utility::Timer;
    4749
    4850namespace ariba {
    4951namespace overlay {
    5052
    51 class OneHop: public OverlayInterface {
     53class OneHop : public OverlayInterface, protected Timer {
    5254        use_logging_h( OneHop );
    5355public:
     
    5860
    5961protected:
     62
     63        /// @see Timer.h
     64        virtual void eventFunction();
     65
    6066        /// @see OverlayInterface.h
    6167        virtual void createOverlay();
  • source/ariba/overlay/modules/onehop/messages/OneHopMessage.h

    r3690 r3705  
    5757                OneHopMessageTypeListingRequest = 1,
    5858                OneHopMessageTypeListingReply   = 2,
    59                 OneHopMessageTypeRoute          = 3,
     59                OneHopMessageTypeLeave          = 3,
     60                OneHopMessageTypeRoute          = 4,
    6061        } OneHopMessageType;
    6162
  • source/ariba/utility/misc/Demultiplexer.hpp

    r3690 r3705  
    8080                        LISTENER_SERVICE_MAP_CITERATOR i = mapListenerService.begin();
    8181                        LISTENER_SERVICE_MAP_CITERATOR iend = mapListenerService.end();
    82                        
     82
    8383                        for( ; i != iend; i++ )
    8484                                cout << "xxx" << i->first.toString() << " -> " << i->second << std::endl;
     
    8888                        SERVICE_LISTENER_MAP_CITERATOR i = mapServiceListener.begin();
    8989                        SERVICE_LISTENER_MAP_CITERATOR iend = mapServiceListener.end();
    90                        
     90
    9191                        for( ; i != iend; i++ )
    9292                                cout << "xxx" << i->first << " -> " << i->second.toString() << std::endl;
     
    112112        void unregisterItem( S id ) {
    113113                T listener = get( id );
    114                
     114
    115115                {
    116116                        boost::mutex::scoped_lock lock( mapMutex );
  • source/ariba/utility/types/Identifier.cpp

    r3690 r3705  
    319319}
    320320bool Identifier::operator==(const Identifier& compKey) const {
    321         return compareTo(compKey) == 0;
     321
     322        if( this->isUnspecified() && compKey.isUnspecified() )
     323                return true;
     324        else
     325                return compareTo(compKey) == 0;
    322326}
    323327bool Identifier::operator!=(const Identifier& compKey) const {
     
    599603        //as mpn_random has no seeding function
    600604        // we mess aroung here a little to achive some randomness
    601         // using the rand function that _is_ seeded in the 
     605        // using the rand function that _is_ seeded in the
    602606        // StartupWrapper::initSystem function
    603607
Note: See TracChangeset for help on using the changeset viewer.