Changeset 3071 for sample/pingpong


Ignore:
Timestamp:
Apr 24, 2009, 4:34:53 PM (16 years ago)
Author:
Christoph Mayer
Message:

-some further fixed in the protocols and cleaning the interfaces for stuff we have no functionality yet

Location:
sample/pingpong
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sample/pingpong/PingPong.cpp

    r3056 r3071  
    8787        Timer::stop();
    8888
     89        // leave spovnet
     90        node->leave();
     91
    8992        // unbind communication and node listener
    9093        node->unbind( this );                               /*NodeListener*/
    9194        node->unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/
    92 
    93         // leave spovnet
    94         node->leave();
    9595
    9696        // stop the ariba module
     
    111111        // this can be all nodes (OneHop) overlay or just some neighbors
    112112        // 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
    113119
    114120        logging_info( "pinging overlay neighbors with ping id " << ++pingId );
     
    139145
    140146void PingPong::onJoinFailed( const SpoVNetID& vid ) {
    141         logging_error("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX pingpong node join failed, spovnetid=" << vid.toString() );
     147        logging_error("pingpong node join failed, spovnetid=" << vid.toString() );
    142148}
    143149
     
    150156}
    151157
    152 // communication listener
    153 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 
    158158void PingPong::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk) {
    159 
    160159        PingPongMessage* pingmsg = msg.getMessage()->convert<PingPongMessage> ();
    161160
     
    176175
    177176void PingPong::onLinkChanged(const LinkID& lnk, const NodeID& remote){
    178         logging_info( "received link-changed event for link " << lnk.toString()
     177        logging_info( "link-changed event for link " << lnk.toString()
    179178                        << " and node " << remote.toString() );
     179}
     180
     181bool 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;
    180184}
    181185
     
    185189}
    186190
    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 
    193191}}} // namespace ariba, application, pingpong
  • sample/pingpong/PingPong.h

    r3056 r3071  
    3535protected:
    3636        // 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);
    3838        virtual void onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk= LinkID::UNSPECIFIED);
    3939        virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
     
    4141        virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
    4242        virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
    43         virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop);
    4443
    4544        // node listener interface
Note: See TracChangeset for help on using the changeset viewer.