net.i2p.router.transport.udp
Class PeerTestManager

java.lang.Object
  extended by net.i2p.router.transport.udp.PeerTestManager

 class PeerTestManager
extends java.lang.Object

From udp.html on the website:

The automation of collaborative reachability testing for peers is enabled by a sequence of PeerTest messages. With its proper execution, a peer will be able to determine their own reachability and may update its behavior accordingly. The testing process is quite simple:

        Alice                  Bob                  Charlie
    PeerTest ------------------->
                             PeerTest-------------------->
                                <-------------------PeerTest
         <-------------------PeerTest
         <------------------------------------------PeerTest
    PeerTest------------------------------------------>
         <------------------------------------------PeerTest

Each of the PeerTest messages carry a nonce identifying the test series itself, as initialized by Alice. If Alice doesn't get a particular message that she expects, she will retransmit accordingly, and based upon the data received or the messages missing, she will know her reachability. The various end states that may be reached are as follows:

Alice should choose Bob arbitrarily from known peers who seem to be capable of participating in peer tests. Bob in turn should choose Charlie arbitrarily from peers that he knows who seem to be capable of participating in peer tests and who are on a different IP from both Bob and Alice. If the first error condition occurs (Alice doesn't get PeerTest messages from Bob), Alice may decide to designate a new peer as Bob and try again with a different nonce.

Alice's introduction key is included in all of the PeerTest messages so that she doesn't need to already have an established session with Bob and so that Charlie can contact her without knowing any additional information. Alice may go on to establish a session with either Bob or Charlie, but it is not required.


Constructor Summary
PeerTestManager(RouterContext context, UDPTransport transport)
          Have seen peer tests (as Alice) get stuck (_currentTest !
 
Method Summary
 void receiveTest(RemoteHostId from, UDPPacketReader reader)
          Receive a test message of some sort from the given peer, queueing up any packet that should be sent in response, or if its a reply to our own current testing, adjusting our test state.
 void runTest(java.net.InetAddress bobIP, int bobPort, SessionKey bobCipherKey, SessionKey bobMACKey)
          The next few methods are for when we are Alice
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerTestManager

public PeerTestManager(RouterContext context,
                       UDPTransport transport)
Have seen peer tests (as Alice) get stuck (_currentTest != null) so I've thrown some synchronizization on the methods; don't know the root cause or whether this fixes it

Method Detail

runTest

public void runTest(java.net.InetAddress bobIP,
                    int bobPort,
                    SessionKey bobCipherKey,
                    SessionKey bobMACKey)
The next few methods are for when we are Alice


receiveTest

public void receiveTest(RemoteHostId from,
                        UDPPacketReader reader)
Receive a test message of some sort from the given peer, queueing up any packet that should be sent in response, or if its a reply to our own current testing, adjusting our test state. We could be Alice, Bob, or Charlie.