Changeset 4866 for source/ariba/overlay


Ignore:
Timestamp:
Jul 13, 2009, 9:42:32 AM (15 years ago)
Author:
Christoph Mayer
Message:

periodic bootstrap vervollständigt

Location:
source/ariba/overlay
Files:
2 edited

Legend:

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

    r4850 r4866  
    4444
    4545use_logging_cpp(OverlayBootstrap);
     46SystemEventType OverlayBootstrapMethodType("OverlayBootstrapMethodType");
    4647
    4748OverlayBootstrap::OverlayBootstrap()
     
    6162
    6263        manager.registerCallback( this );
    63         manager.registerAllModules();
     64        manager.registerModule( BootstrapManager::BootstrapTypePeriodicBroadcast );
    6465}
    6566void OverlayBootstrap::stop(){
     
    6970
    7071        manager.unregisterCallback( this );
    71         manager.unregisterAllModules();
     72        manager.unregisterModule( BootstrapManager::BootstrapTypePeriodicBroadcast );
     73}
     74
     75void OverlayBootstrap::handleSystemEvent(const SystemEvent& event){
     76
     77
     78        EventData* data = event.getData<EventData>();
     79
     80        // announcement for our spovnet
     81        logging_info( "found bootstrap node for our SpoVNetID " << data->spovnetid.toString()
     82                        << " on NodeID " << data->nodeid.toString() << " with endpoint " << data->endpoint.toString() );
     83
     84
     85        // TODO: do stuff on overlay
     86
     87
     88        delete data;
    7289}
    7390
     
    95112        if( nid == this->nodeid ) return;
    96113
    97         // announcement for our spovnet
    98         logging_info( "found bootstrap node for our SpoVNetID " << sid.toString()
    99                         << " on NodeID " << nid << " with endpoint " << ep.toString() );
     114        //
     115        // send out the bootstrap information as
     116        // event to synchronize into the system queue
     117        //
     118
     119        EventData* data = new EventData();
     120        data->spovnetid = sid;
     121        data->nodeid = nid;
     122        data->endpoint = ep;
     123
     124        SystemQueue::instance().scheduleEvent(
     125                        SystemEvent( this, OverlayBootstrapMethodType, data), 0 );
    100126}
    101127
  • source/ariba/overlay/OverlayBootstrap.h

    r4836 r4866  
    4747#include "ariba/utility/bootstrap/BootstrapInformationCallback.h"
    4848#include "ariba/communication/EndpointDescriptor.h"
     49#include "ariba/utility/system/SystemEventListener.h"
     50#include "ariba/utility/system/SystemQueue.h"
     51#include "ariba/utility/system/SystemEvent.h"
     52#include "ariba/utility/system/SystemEventType.h"
    4953
    5054using std::string;
     
    5559using ariba::utility::BootstrapInformationCallback;
    5660using ariba::communication::EndpointDescriptor;
     61using ariba::utility::SystemEventType;
     62using ariba::utility::SystemEvent;
     63using ariba::utility::SystemQueue;
     64using ariba::utility::SystemEventListener;
    5765
    5866namespace ariba {
     
    6169class BaseOverlay;
    6270
    63 class OverlayBootstrap : public BootstrapInformationCallback {
     71class OverlayBootstrap : public BootstrapInformationCallback, public SystemEventListener {
    6472        use_logging_h(OverlayBootstrap);
    6573public:
     
    7482
    7583protected:
     84        virtual void handleSystemEvent(const SystemEvent& event);
    7685        virtual void onBootstrapServiceFound(string name, string info1, string info2, string info);
    7786
    7887private:
     88        typedef struct _EventData {
     89                SpoVNetID spovnetid;
     90                NodeID nodeid;
     91                EndpointDescriptor endpoint;
     92        } EventData;
     93
    7994        BootstrapManager& manager;
    8095        SpoVNetID spovnetid;
Note: See TracChangeset for help on using the changeset viewer.