Changeset 3041 for sample/pingpong


Ignore:
Timestamp:
Apr 23, 2009, 9:18:12 AM (16 years ago)
Author:
Christoph Mayer
Message:

-mehrere Fixes, Tickets #25 (bind listeners earlier), #21 (better pingpong), #40 (systemqueue misbehavior)

Location:
sample/pingpong
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sample/pingpong/PingPong.cpp

    r3037 r3041  
    6262        node = new Node( *ariba, nodeName );
    6363
     64        // bind communication and node listener
     65        node->bind( this );                       /*NodeListener*/
     66        node->bind( this, PingPong::PINGPONG_ID); /*CommunicationListener*/
     67
    6468        // start node module
    6569        node->start();
     
    6872        if (!isInitiator) node->join(spovnetName);
    6973        else node->initiate(spovnetName);
    70 
    71         // bind communication and node listener
    72         node->bind( this );                       /*NodeListener*/
    73         node->bind( this, PingPong::PINGPONG_ID); /*CommunicationListener*/
    74 
    75         // start the ping timer. if we are not
    76         // the initiator this will happen in onJoinCompleted
    77         if( isInitiator ) Timer::start();
    7874
    7975        // ping pong started up...
     
    109105}
    110106
    111 // node listener interface
    112 void PingPong::onJoinCompleted( const SpoVNetID& vid ) {
    113         logging_error( "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX pingpong node join completed, spovnetid=" << vid.toString() );
    114 
    115         // start the timer to ping every second
    116         Timer::start();
    117 }
    118 
    119 void PingPong::onJoinFailed( const SpoVNetID& vid ) {
    120         logging_error("pingpong node join failed, spovnetid=" << vid.toString() );
    121 }
    122 
    123 void PingPong::onLeaveCompleted( const SpoVNetID& vid ){
    124         logging_info("pingpong node leave completed, spovnetid=" << vid.toString() );
    125 }
    126 
    127 void PingPong::onLeaveFailed( const SpoVNetID& vid ){
    128         logging_error("pingpong node leave failed, spovnetid=" << vid.toString() );
    129 }
    130 
    131107// timer event
    132108void PingPong::eventFunction() {
     
    153129        //-----------------------------------------------------------------------
    154130        // node->sendBroadcastMessage( pingmsg, PingPong::PINGPONG_ID );
     131}
     132
     133// node listener interface
     134void PingPong::onJoinCompleted( const SpoVNetID& vid ) {
     135        logging_error( "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX pingpong node join completed, spovnetid=" << vid.toString() );
     136
     137        // start the timer to ping every second
     138        Timer::start();
     139}
     140
     141void PingPong::onJoinFailed( const SpoVNetID& vid ) {
     142        logging_error("pingpong node join failed, spovnetid=" << vid.toString() );
     143}
     144
     145void PingPong::onLeaveCompleted( const SpoVNetID& vid ){
     146        logging_info("pingpong node leave completed, spovnetid=" << vid.toString() );
     147}
     148
     149void PingPong::onLeaveFailed( const SpoVNetID& vid ){
     150        logging_error("pingpong node leave failed, spovnetid=" << vid.toString() );
    155151}
    156152
  • sample/pingpong/main.cpp

    r2413 r3041  
    2020        StartupWrapper::startup(&ping, true);
    2121
    22         // this will run blocking until <enter> is hit
    23         StartupWrapper::shutdown();
     22        // --> we will run blocking until <enter> is hit
     23
     24        StartupWrapper::shutdown(&ping);
    2425        return 0;
    2526}
Note: See TracChangeset for help on using the changeset viewer.