Changeset 3071 for sample/pingpong
- Timestamp:
- Apr 24, 2009, 4:34:53 PM (16 years ago)
- Location:
- sample/pingpong
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sample/pingpong/PingPong.cpp
r3056 r3071 87 87 Timer::stop(); 88 88 89 // leave spovnet 90 node->leave(); 91 89 92 // unbind communication and node listener 90 93 node->unbind( this ); /*NodeListener*/ 91 94 node->unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/ 92 93 // leave spovnet94 node->leave();95 95 96 96 // stop the ariba module … … 111 111 // this can be all nodes (OneHop) overlay or just some neighbors 112 112 // in case of a Chord or Kademlia structure 113 114 // in this sample we use auto-links: we just send out our message 115 // to the node and the link is established automatically. for more 116 // control we would use the node->establishLink function to create 117 // a link and start using the link in the CommunicationListener::onLinkUp 118 // function that is implemented further down in PingPong::onLinkUp 113 119 114 120 logging_info( "pinging overlay neighbors with ping id " << ++pingId ); … … 139 145 140 146 void PingPong::onJoinFailed( const SpoVNetID& vid ) { 141 logging_error(" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXpingpong node join failed, spovnetid=" << vid.toString() );147 logging_error("pingpong node join failed, spovnetid=" << vid.toString() ); 142 148 } 143 149 … … 150 156 } 151 157 152 // communication listener153 bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) {154 logging_debug( "node " << remote.toString() << " wants to build up a link with us ... allowing" );155 return true;156 }157 158 158 void PingPong::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk) { 159 160 159 PingPongMessage* pingmsg = msg.getMessage()->convert<PingPongMessage> (); 161 160 … … 176 175 177 176 void PingPong::onLinkChanged(const LinkID& lnk, const NodeID& remote){ 178 logging_info( " receivedlink-changed event for link " << lnk.toString()177 logging_info( "link-changed event for link " << lnk.toString() 179 178 << " and node " << remote.toString() ); 179 } 180 181 bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) { 182 logging_info( "node " << remote.toString() << " wants to build up a link with us ... allowing" ); 183 return true; 180 184 } 181 185 … … 185 189 } 186 190 187 void PingPong::onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop){188 logging_info( "received link-qos-changed event for link " << lnk.toString()189 << " and node " << remote.toString()190 << " with link properties " << prop.toString() );191 }192 193 191 }}} // namespace ariba, application, pingpong -
sample/pingpong/PingPong.h
r3056 r3071 35 35 protected: 36 36 // communication listener interface 37 virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg );37 virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg = DataMessage::UNSPECIFIED); 38 38 virtual void onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk= LinkID::UNSPECIFIED); 39 39 virtual void onLinkUp(const LinkID& lnk, const NodeID& remote); … … 41 41 virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote); 42 42 virtual void onLinkFail(const LinkID& lnk, const NodeID& remote); 43 virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop);44 43 45 44 // node listener interface
Note:
See TracChangeset
for help on using the changeset viewer.