Changeset 3056 for sample/pingpong
- Timestamp:
- Apr 23, 2009, 6:58:34 PM (16 years ago)
- Location:
- sample/pingpong
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sample/pingpong/PingPong.cpp
r3055 r3056 13 13 14 14 // the service that the pingpong wants to use 15 ServiceID PingPong::PINGPONG_ ID = ServiceID( 111 );15 ServiceID PingPong::PINGPONG_SERVICEID = ServiceID( 111 ); 16 16 17 17 // construction … … 63 63 64 64 // bind communication and node listener 65 node->bind( this ); /*NodeListener*/66 node->bind( this, PingPong::PINGPONG_ ID); /*CommunicationListener*/65 node->bind( this ); /*NodeListener*/ 66 node->bind( this, PingPong::PINGPONG_SERVICEID); /*CommunicationListener*/ 67 67 68 68 // start node module … … 88 88 89 89 // unbind communication and node listener 90 node->unbind( this ); /*NodeListener*/91 node->unbind( this, PingPong::PINGPONG_ ID ); /*CommunicationListener*/90 node->unbind( this ); /*NodeListener*/ 91 node->unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/ 92 92 93 93 // leave spovnet … … 121 121 vector<NodeID> nodes = node->getNeighborNodes(); 122 122 BOOST_FOREACH( NodeID nid, nodes ){ 123 node->sendMessage( pingmsg, nid, PingPong::PINGPONG_ ID );123 node->sendMessage( pingmsg, nid, PingPong::PINGPONG_SERVICEID ); 124 124 } 125 125 … … 128 128 // internally, gets all neighboring nodes and sends the message 129 129 //----------------------------------------------------------------------- 130 // node->sendBroadcastMessage( pingmsg, PingPong::PINGPONG_ ID );130 // node->sendBroadcastMessage( pingmsg, PingPong::PINGPONG_SERVICEID ); 131 131 } 132 132 133 // node listener interface134 133 void PingPong::onJoinCompleted( const SpoVNetID& vid ) { 135 134 logging_info( "pingpong node join completed, spovnetid=" << vid.toString() ); … … 153 152 // communication listener 154 153 bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) { 155 return false; 154 logging_debug( "node " << remote.toString() << " wants to build up a link with us ... allowing" ); 155 return true; 156 156 } 157 157 … … 191 191 } 192 192 193 void PingPong::onMessageSent(seqnum_t seq_num, bool failed, const DataMessage& msg ){194 logging_info( "received message sent event for seqnum " << seq_num195 << " with result " << failed );196 }197 198 193 }}} // namespace ariba, application, pingpong -
sample/pingpong/PingPong.h
r3037 r3056 42 42 virtual void onLinkFail(const LinkID& lnk, const NodeID& remote); 43 43 virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop); 44 virtual void onMessageSent(seqnum_t seq_num, bool failed, const DataMessage& msg = DataMessage::UNSPECIFIED);45 44 46 45 // node listener interface … … 60 59 // the ariba module and a node 61 60 AribaModule* ariba; 62 Node* node;61 Node* node; 63 62 64 63 // flag, whether this node initiates or just joins the spovnet … … 66 65 67 66 // the ping pong service id 68 static ServiceID PINGPONG_ ID;67 static ServiceID PINGPONG_SERVICEID; 69 68 70 69 // the current ping id
Note:
See TracChangeset
for help on using the changeset viewer.