net.i2p.router.tunnel.pool
Class TunnelPoolManager

java.lang.Object
  extended bynet.i2p.router.tunnel.pool.TunnelPoolManager
All Implemented Interfaces:
Service, TunnelManagerFacade

public class TunnelPoolManager
extends java.lang.Object
implements TunnelManagerFacade


Constructor Summary
TunnelPoolManager(RouterContext ctx)
           
 
Method Summary
(package private)  int allocateBuilds(int wanted)
          Check to make sure we can build this many new tunnels (throttled so we don't build too many at a time across all pools).
(package private)  void buildComplete()
           
 void buildTunnels(Destination client, ClientTunnelSettings settings)
          the client connected (or updated their settings), so make sure we have the tunnels for them, and whenever necessary, ask them to authorize leases.
 int getFreeTunnelCount()
          how many free inbound tunnels do we have available?
 TunnelPoolSettings getInboundSettings()
           
 TunnelPoolSettings getInboundSettings(Hash client)
           
 long getLastParticipatingExpiration()
          When does the last tunnel we are participating in expire?
 TunnelPoolSettings getOutboundSettings()
           
 TunnelPoolSettings getOutboundSettings(Hash client)
           
 int getOutboundTunnelCount()
          how many outbound tunnels do we have available?
 int getParticipatingCount()
          how many tunnels are we participating in?
 TunnelInfo getTunnelInfo(TunnelId id)
          Retrieve the information related to a particular tunnel
 boolean isInUse(Hash peer)
          True if the peer currently part of a tunnel
 void removeTunnels(Hash destination)
           
 void renderStatusHTML(java.io.Writer out)
           
 void restart()
          Perform a soft restart.
 TunnelInfo selectInboundTunnel()
          pick an inbound tunnel not bound to a particular destination
 TunnelInfo selectInboundTunnel(Hash destination)
          pick an inbound tunnel bound to the given destination
 TunnelInfo selectOutboundTunnel()
          pick an outbound tunnel not bound to a particular destination
 TunnelInfo selectOutboundTunnel(Hash destination)
          pick an outbound tunnel bound to the given destination
 void setInboundSettings(Hash client, TunnelPoolSettings settings)
           
 void setInboundSettings(TunnelPoolSettings settings)
           
 void setOutboundSettings(Hash client, TunnelPoolSettings settings)
           
 void setOutboundSettings(TunnelPoolSettings settings)
           
 void shutdown()
          Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully.
 void startup()
          Instruct the service that it should start normal operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TunnelPoolManager

public TunnelPoolManager(RouterContext ctx)
Method Detail

selectInboundTunnel

public TunnelInfo selectInboundTunnel()
pick an inbound tunnel not bound to a particular destination

Specified by:
selectInboundTunnel in interface TunnelManagerFacade

selectInboundTunnel

public TunnelInfo selectInboundTunnel(Hash destination)
pick an inbound tunnel bound to the given destination

Specified by:
selectInboundTunnel in interface TunnelManagerFacade

selectOutboundTunnel

public TunnelInfo selectOutboundTunnel()
pick an outbound tunnel not bound to a particular destination

Specified by:
selectOutboundTunnel in interface TunnelManagerFacade

selectOutboundTunnel

public TunnelInfo selectOutboundTunnel(Hash destination)
pick an outbound tunnel bound to the given destination

Specified by:
selectOutboundTunnel in interface TunnelManagerFacade

getTunnelInfo

public TunnelInfo getTunnelInfo(TunnelId id)
Description copied from interface: TunnelManagerFacade
Retrieve the information related to a particular tunnel

Specified by:
getTunnelInfo in interface TunnelManagerFacade
Parameters:
id - the tunnelId as seen at the gateway

getFreeTunnelCount

public int getFreeTunnelCount()
Description copied from interface: TunnelManagerFacade
how many free inbound tunnels do we have available?

Specified by:
getFreeTunnelCount in interface TunnelManagerFacade

getOutboundTunnelCount

public int getOutboundTunnelCount()
Description copied from interface: TunnelManagerFacade
how many outbound tunnels do we have available?

Specified by:
getOutboundTunnelCount in interface TunnelManagerFacade

getParticipatingCount

public int getParticipatingCount()
Description copied from interface: TunnelManagerFacade
how many tunnels are we participating in?

Specified by:
getParticipatingCount in interface TunnelManagerFacade

getLastParticipatingExpiration

public long getLastParticipatingExpiration()
Description copied from interface: TunnelManagerFacade
When does the last tunnel we are participating in expire?

Specified by:
getLastParticipatingExpiration in interface TunnelManagerFacade

isInUse

public boolean isInUse(Hash peer)
Description copied from interface: TunnelManagerFacade
True if the peer currently part of a tunnel

Specified by:
isInUse in interface TunnelManagerFacade

getInboundSettings

public TunnelPoolSettings getInboundSettings()
Specified by:
getInboundSettings in interface TunnelManagerFacade

getOutboundSettings

public TunnelPoolSettings getOutboundSettings()
Specified by:
getOutboundSettings in interface TunnelManagerFacade

setInboundSettings

public void setInboundSettings(TunnelPoolSettings settings)
Specified by:
setInboundSettings in interface TunnelManagerFacade

setOutboundSettings

public void setOutboundSettings(TunnelPoolSettings settings)
Specified by:
setOutboundSettings in interface TunnelManagerFacade

getInboundSettings

public TunnelPoolSettings getInboundSettings(Hash client)
Specified by:
getInboundSettings in interface TunnelManagerFacade

getOutboundSettings

public TunnelPoolSettings getOutboundSettings(Hash client)
Specified by:
getOutboundSettings in interface TunnelManagerFacade

setInboundSettings

public void setInboundSettings(Hash client,
                               TunnelPoolSettings settings)
Specified by:
setInboundSettings in interface TunnelManagerFacade

setOutboundSettings

public void setOutboundSettings(Hash client,
                                TunnelPoolSettings settings)
Specified by:
setOutboundSettings in interface TunnelManagerFacade

restart

public void restart()
Description copied from interface: Service
Perform a soft restart.

Specified by:
restart in interface Service

buildTunnels

public void buildTunnels(Destination client,
                         ClientTunnelSettings settings)
Description copied from interface: TunnelManagerFacade
the client connected (or updated their settings), so make sure we have the tunnels for them, and whenever necessary, ask them to authorize leases.

Specified by:
buildTunnels in interface TunnelManagerFacade

removeTunnels

public void removeTunnels(Hash destination)

allocateBuilds

int allocateBuilds(int wanted)
Check to make sure we can build this many new tunnels (throttled so we don't build too many at a time across all pools).

Parameters:
wanted - how many tunnels the pool wants to build
Returns:
how many are allowed to be built

buildComplete

void buildComplete()

startup

public void startup()
Description copied from interface: Service
Instruct the service that it should start normal operation. This call DOES block until the service is ready.

Specified by:
startup in interface Service

shutdown

public void shutdown()
Description copied from interface: Service
Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully. It should not depend on other components at this point. This call DOES block.

Specified by:
shutdown in interface Service

renderStatusHTML

public void renderStatusHTML(java.io.Writer out)
                      throws java.io.IOException
Specified by:
renderStatusHTML in interface Service
Throws:
java.io.IOException