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


Ignore:
Timestamp:
Jan 22, 2009, 10:06:17 PM (15 years ago)
Author:
huebsch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Tutorial/PingPong

    v21 v22  
    154154}}}
    155155
    156 Node leaves in our case only lead to deletion of links we had stored, for we don't need them anymore (line 102).
     156Node leaves in our case only lead to deletion of links we had stored before, for we don't need them anymore (line 102).
     157
     158So far, the node is up and running, created or joined a SpoVNet instance. The initiaor started a timer as soon as another node had joined. Now we see what happens when the timer is triggered.
    157159
    158160
     161{{{
     162110 void PingPong::eventFunction(){
     163111
     164112     logging_info( "pinging our remote nodes" );
     165113
     166114     RemoteNodes::iterator i = remoteNodes.begin();
     167115     RemoteNodes::iterator iend = remoteNodes.end();
     168116
     169117     pingid++;
     170118
     171119     for( ; i != iend; i++ ){
     172120             logging_info( "     -> pinging " << i->first );
     173121
     174122             PingPongMessage pingmsg( pingid );
     175123             overlay->sendMessage( &pingmsg, i->second );
     176124     }
     177125 }
     178}}}
     179
     180Everytime the timer 'fires', ''eventFunction'' is called on a node (lines 110-125). In this example, the initiator sends a message to every node that has joined up to this point in time. To accomplish this, it iterates through all established links (line 119), builts a message for every link and finally sends the message using the Base Overlay in ''Ariba''.
     181