net.i2p.router.transport.udp
Class IntroductionManager

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

 class IntroductionManager
extends Object

Keep track of inbound and outbound introductions.


Field Summary
static int MAX_OUTBOUND
          This is enforced in EstablishmentManager
 
Constructor Summary
IntroductionManager(RouterContext ctx, UDPTransport transport)
           
 
Method Summary
 void add(PeerState peer)
           
(package private)  int introducedCount()
           
(package private)  int introducerCount()
          Not as elaborate as pickInbound() above.
 int pickInbound(Properties ssuOptions, int howMany)
          Grab a bunch of peers who are willing to be introducers for us that are locally known (duh) and have published their own SSU address (duh^2).
 void pingIntroducers()
          Was part of pickInbound(), moved out so we can call it more often
(package private)  void receiveRelayIntro(RemoteHostId bob, UDPPacketReader reader)
          We are Charlie and we got this from Bob.
(package private)  void receiveRelayRequest(RemoteHostId alice, UDPPacketReader reader)
          We are Bob and we got this from Alice.
 void remove(PeerState peer)
           
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_OUTBOUND

public static final int MAX_OUTBOUND
This is enforced in EstablishmentManager

Since:
0.8.11
See Also:
Constant Field Values
Constructor Detail

IntroductionManager

public IntroductionManager(RouterContext ctx,
                           UDPTransport transport)
Method Detail

reset

public void reset()

add

public void add(PeerState peer)

remove

public void remove(PeerState peer)

pickInbound

public int pickInbound(Properties ssuOptions,
                       int howMany)
Grab a bunch of peers who are willing to be introducers for us that are locally known (duh) and have published their own SSU address (duh^2). The picked peers have their info tacked on to the ssuOptions parameter for use in the SSU RouterAddress. Try to use "good" peers (i.e. reachable, active) Also, ping all idle peers that were introducers in the last 2 hours, to keep the connection up, since the netDb can have quite stale information, and we want to keep our introducers valid.


pingIntroducers

public void pingIntroducers()
Was part of pickInbound(), moved out so we can call it more often

Since:
0.8.11

introducerCount

int introducerCount()
Not as elaborate as pickInbound() above. Just a quick check to see how many volunteers we know, which the Transport uses to see if we need more.

Returns:
number of peers that have volunteered to introduce us

introducedCount

int introducedCount()
Returns:
number of peers we have volunteered to introduce
Since:
0.9.3

receiveRelayIntro

void receiveRelayIntro(RemoteHostId bob,
                       UDPPacketReader reader)
We are Charlie and we got this from Bob. Send a HolePunch to Alice, who will soon be sending us a RelayRequest. We should already have a session with Bob, but probably not with Alice. We do some throttling here.


receiveRelayRequest

void receiveRelayRequest(RemoteHostId alice,
                         UDPPacketReader reader)
We are Bob and we got this from Alice. Send a RelayIntro to Charlie and a RelayResponse to Alice. We should already have a session with Charlie, but not necessarily with Alice.