|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.util.EventDispatcherImpl
net.i2p.i2ptunnel.I2PTunnelTask
net.i2p.i2ptunnel.I2PTunnelClientBase
public abstract class I2PTunnelClientBase
Field Summary | |
---|---|
protected long |
_clientId
|
protected I2PAppContext |
_context
|
protected Log |
_log
|
protected boolean |
_ownDest
|
(package private) static long |
DEFAULT_CONNECT_TIMEOUT
|
protected Destination |
dest
|
protected Logging |
l
|
protected List<I2PSocket> |
mySockets
|
protected Object |
sockLock
|
protected I2PSocketManager |
sockMgr
|
protected ServerSocket |
ss
|
Fields inherited from class net.i2p.i2ptunnel.I2PTunnelTask |
---|
open |
Constructor Summary | |
---|---|
I2PTunnelClientBase(int localPort,
boolean ownDest,
Logging l,
EventDispatcher notifyThis,
String handlerName,
I2PTunnel tunnel)
The main constructor. |
|
I2PTunnelClientBase(int localPort,
boolean ownDest,
Logging l,
EventDispatcher notifyThis,
String handlerName,
I2PTunnel tunnel,
String pkf)
Use this to build a client with a persistent private key. |
|
I2PTunnelClientBase(int localPort,
Logging l,
I2PSocketManager sktMgr,
I2PTunnel tunnel,
EventDispatcher notifyThis,
long clientId)
This constructor always starts the tunnel (ignoring the i2cp.delayOpen option). |
Method Summary | |
---|---|
protected I2PSocketManager |
buildSocketManager()
This may take a LONG time. |
protected static I2PSocketManager |
buildSocketManager(I2PTunnel tunnel)
This may take a LONG time. |
protected static I2PSocketManager |
buildSocketManager(I2PTunnel tunnel,
String pkf)
This may take a LONG time. |
protected static I2PSocketManager |
buildSocketManager(I2PTunnel tunnel,
String pkf,
Logging log)
This may take a LONG time. |
protected abstract void |
clientConnectionRun(Socket s)
Manage a connection in a separate thread. |
boolean |
close(boolean forced)
|
static void |
closeSocket(Socket s)
|
I2PSocket |
createI2PSocket(Destination dest)
Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel. |
I2PSocket |
createI2PSocket(Destination dest,
I2PSocketOptions opt)
Create a new I2PSocket towards to the specified destination, adding it to the list of connections actually managed by this tunnel. |
(package private) static ThreadPoolExecutor |
getClientExecutor()
|
protected I2PSocketOptions |
getDefaultOptions()
Create the default options (using the default timeout, etc). |
protected I2PSocketOptions |
getDefaultOptions(Properties overrides)
Create the default options (using the default timeout, etc). |
protected InetAddress |
getListenHost(Logging l)
|
int |
getLocalPort()
|
protected I2PSocketManager |
getSocketManager()
This is ONLY for shared clients. |
protected static I2PSocketManager |
getSocketManager(I2PTunnel tunnel)
This is ONLY for shared clients. |
protected static I2PSocketManager |
getSocketManager(I2PTunnel tunnel,
String pkf)
This is ONLY for shared clients. |
(package private) static void |
killClientExecutor()
|
protected void |
manageConnection(Socket s)
Manage the connection just opened on the specified socket |
void |
optionsUpdated(I2PTunnel tunnel)
Update the I2PSocketManager. |
void |
run()
|
void |
startRunning()
Actually start working on incoming connections. |
protected void |
verifySocketManager()
Sets the this.sockMgr field if it is null, or if we want a new one. |
Methods inherited from class net.i2p.i2ptunnel.I2PTunnelTask |
---|
connected, disconnected, errorOccurred, getId, getTunnel, isOpen, reportAbuse, routerDisconnected, setId, setName, setTunnel, toString |
Methods inherited from class net.i2p.util.EventDispatcherImpl |
---|
attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Log _log
protected final I2PAppContext _context
protected final Logging l
static final long DEFAULT_CONNECT_TIMEOUT
protected long _clientId
protected final Object sockLock
protected I2PSocketManager sockMgr
protected final List<I2PSocket> mySockets
protected boolean _ownDest
protected Destination dest
protected ServerSocket ss
Constructor Detail |
---|
public I2PTunnelClientBase(int localPort, Logging l, I2PSocketManager sktMgr, I2PTunnel tunnel, EventDispatcher notifyThis, long clientId) throws IllegalArgumentException
localPort
- if 0, use any port, get actual port selected with getLocalPort()sktMgr
- the existing socket manager
IllegalArgumentException
public I2PTunnelClientBase(int localPort, boolean ownDest, Logging l, EventDispatcher notifyThis, String handlerName, I2PTunnel tunnel) throws IllegalArgumentException
localPort
- if 0, use any port, get actual port selected with getLocalPort()
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we can't create a socketManagerpublic I2PTunnelClientBase(int localPort, boolean ownDest, Logging l, EventDispatcher notifyThis, String handlerName, I2PTunnel tunnel, String pkf) throws IllegalArgumentException
localPort
- if 0, use any port, get actual port selected with getLocalPort()pkf
- Path to the private key file, or null to generate a transient key
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we can't create a socketManagerMethod Detail |
---|
protected void verifySocketManager()
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerprotected I2PSocketManager getSocketManager()
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerprotected static I2PSocketManager getSocketManager(I2PTunnel tunnel)
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerprotected static I2PSocketManager getSocketManager(I2PTunnel tunnel, String pkf)
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerprotected I2PSocketManager buildSocketManager()
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerprotected static I2PSocketManager buildSocketManager(I2PTunnel tunnel)
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerprotected static I2PSocketManager buildSocketManager(I2PTunnel tunnel, String pkf)
pkf
- absolute path or null
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerprotected static I2PSocketManager buildSocketManager(I2PTunnel tunnel, String pkf, Logging log)
pkf
- absolute path or null
IllegalArgumentException
- if the I2CP configuration is b0rked so
badly that we cant create a socketManagerpublic final int getLocalPort()
protected final InetAddress getListenHost(Logging l)
public void startRunning()
protected I2PSocketOptions getDefaultOptions()
protected I2PSocketOptions getDefaultOptions(Properties overrides)
public void optionsUpdated(I2PTunnel tunnel)
optionsUpdated
in class I2PTunnelTask
public I2PSocket createI2PSocket(Destination dest) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException
dest
- The destination to connect to
I2PException
ConnectException
NoRouteToHostException
InterruptedIOException
public I2PSocket createI2PSocket(Destination dest, I2PSocketOptions opt) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException
dest
- The destination to connect toopt
- Option to be used to open when opening the socket
ConnectException
- if the peer refuses the connection
NoRouteToHostException
- if the peer is not found or not reachable
InterruptedIOException
- if the connection timeouts
I2PException
- if there is some other I2P-related problempublic final void run()
run
in interface Runnable
static ThreadPoolExecutor getClientExecutor()
static void killClientExecutor()
protected void manageConnection(Socket s)
s
- Socket to take care ofpublic boolean close(boolean forced)
close
in class I2PTunnelTask
public static void closeSocket(Socket s)
protected abstract void clientConnectionRun(Socket s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |