- Timestamp:
- Apr 23, 2009, 9:18:12 AM (16 years ago)
- Location:
- sample/pingpong
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sample/pingpong/PingPong.cpp
r3037 r3041 62 62 node = new Node( *ariba, nodeName ); 63 63 64 // bind communication and node listener 65 node->bind( this ); /*NodeListener*/ 66 node->bind( this, PingPong::PINGPONG_ID); /*CommunicationListener*/ 67 64 68 // start node module 65 69 node->start(); … … 68 72 if (!isInitiator) node->join(spovnetName); 69 73 else node->initiate(spovnetName); 70 71 // bind communication and node listener72 node->bind( this ); /*NodeListener*/73 node->bind( this, PingPong::PINGPONG_ID); /*CommunicationListener*/74 75 // start the ping timer. if we are not76 // the initiator this will happen in onJoinCompleted77 if( isInitiator ) Timer::start();78 74 79 75 // ping pong started up... … … 109 105 } 110 106 111 // node listener interface112 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 second116 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 131 107 // timer event 132 108 void PingPong::eventFunction() { … … 153 129 //----------------------------------------------------------------------- 154 130 // node->sendBroadcastMessage( pingmsg, PingPong::PINGPONG_ID ); 131 } 132 133 // node listener interface 134 void 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 141 void PingPong::onJoinFailed( const SpoVNetID& vid ) { 142 logging_error("pingpong node join failed, spovnetid=" << vid.toString() ); 143 } 144 145 void PingPong::onLeaveCompleted( const SpoVNetID& vid ){ 146 logging_info("pingpong node leave completed, spovnetid=" << vid.toString() ); 147 } 148 149 void PingPong::onLeaveFailed( const SpoVNetID& vid ){ 150 logging_error("pingpong node leave failed, spovnetid=" << vid.toString() ); 155 151 } 156 152 -
sample/pingpong/main.cpp
r2413 r3041 20 20 StartupWrapper::startup(&ping, true); 21 21 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); 24 25 return 0; 25 26 }
Note:
See TracChangeset
for help on using the changeset viewer.