Changes between Version 20 and Version 21 of Documentation/Tutorial/PingPong


Ignore:
Timestamp:
Jan 22, 2009, 9:59:35 PM (15 years ago)
Author:
huebsch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Tutorial/PingPong

    v20 v21  
    147147''Ariba'' provides several callback functions that may used by services to catch all kinds of events that could be of interest. In this exampe we limit ourselves to the event cases of node joins and node leaves. When a node successfull joines to the SpoVNet instance, ''onNodeJoin'' is triggered nn the initiator's service side. He may then react to this event, exemplary shown in line 80-93, implementing ''onNodeJoin''. In this case, the initiator starts establishing a link to the joined node (line 85), essentially for all kinds of communications via ''Ariba''. We then store the link for further usage (line 88) and prepare a timer which intention is to trigger periodic events. In our case we initialize the timer to be triggered every 2 seconds (line 90), before starting it (line 91).
    148148
     149{{{
     150100 void PingPong::onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid ){
     151101     RemoteNodes::iterator i = remoteNodes.find( id );
     152102     if( i != remoteNodes.end() ) remoteNodes.erase( i );
     153103 }
     154}}}
     155
     156Node leaves in our case only lead to deletion of links we had stored, for we don't need them anymore (line 102).
    149157
    150158
    151 
    152