net.i2p.i2ptunnel
Class I2PTunnelServer

java.lang.Object
  extended by net.i2p.i2ptunnel.I2PTunnelTask
      extended by net.i2p.i2ptunnel.I2PTunnelServer
All Implemented Interfaces:
java.lang.Runnable, EventDispatcher
Direct Known Subclasses:
I2PTunnelHTTPServer, I2PTunnelIRCServer

public class I2PTunnelServer
extends I2PTunnelTask
implements java.lang.Runnable


Field Summary
protected static long __serverId
           
protected  boolean bidir
           
protected  I2PServerSocket i2pss
           
protected  int localPort
           
protected  long readTimeout
          default timeout to 3 minutes - override if desired
protected  java.net.InetAddress remoteHost
           
protected  int remotePort
           
protected  java.lang.Object slock
           
protected  I2PSocketManager sockMgr
           
protected  I2PTunnelTask task
           
 
Fields inherited from class net.i2p.i2ptunnel.I2PTunnelTask
open
 
Constructor Summary
I2PTunnelServer(java.net.InetAddress host, int port, java.io.File privkey, java.lang.String privkeyname, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
           
I2PTunnelServer(java.net.InetAddress host, int port, java.io.InputStream privData, java.lang.String privkeyname, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
           
I2PTunnelServer(java.net.InetAddress host, int port, java.lang.String privData, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
           
 
Method Summary
protected  void blockingHandle(I2PSocket socket)
           
 boolean close(boolean forced)
           
protected  int getHandlerCount()
           
 long getReadTimeout()
          Get the read idle timeout for newly-created connections (in milliseconds).
 void run()
           
 void setReadTimeout(long ms)
          Set the read idle timeout for newly-created connections (in milliseconds).
 boolean shouldUsePool()
           
 void startRunning()
          Start running the I2PTunnelServer.
 
Methods inherited from class net.i2p.i2ptunnel.I2PTunnelTask
attachEventDispatcher, detachEventDispatcher, disconnected, errorOccurred, getEventDispatcher, getEvents, getEventValue, getId, getTunnel, ignoreEvents, isOpen, notifyEvent, reportAbuse, routerDisconnected, setId, setName, setTunnel, toString, unIgnoreEvents, waitEventValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sockMgr

protected I2PSocketManager sockMgr

i2pss

protected I2PServerSocket i2pss

slock

protected final java.lang.Object slock

remoteHost

protected java.net.InetAddress remoteHost

remotePort

protected int remotePort

readTimeout

protected long readTimeout
default timeout to 3 minutes - override if desired


__serverId

protected static volatile long __serverId

task

protected I2PTunnelTask task

bidir

protected boolean bidir

localPort

protected int localPort
Constructor Detail

I2PTunnelServer

public I2PTunnelServer(java.net.InetAddress host,
                       int port,
                       java.lang.String privData,
                       Logging l,
                       EventDispatcher notifyThis,
                       I2PTunnel tunnel)

I2PTunnelServer

public I2PTunnelServer(java.net.InetAddress host,
                       int port,
                       java.io.File privkey,
                       java.lang.String privkeyname,
                       Logging l,
                       EventDispatcher notifyThis,
                       I2PTunnel tunnel)

I2PTunnelServer

public I2PTunnelServer(java.net.InetAddress host,
                       int port,
                       java.io.InputStream privData,
                       java.lang.String privkeyname,
                       Logging l,
                       EventDispatcher notifyThis,
                       I2PTunnel tunnel)
Method Detail

startRunning

public void startRunning()
Start running the I2PTunnelServer.


setReadTimeout

public void setReadTimeout(long ms)
Set the read idle timeout for newly-created connections (in milliseconds). After this time expires without data being reached from the I2P network, the connection itself will be closed.


getReadTimeout

public long getReadTimeout()
Get the read idle timeout for newly-created connections (in milliseconds).

Returns:
The read timeout used for connections

close

public boolean close(boolean forced)
Specified by:
close in class I2PTunnelTask

getHandlerCount

protected int getHandlerCount()

run

public void run()
Specified by:
run in interface java.lang.Runnable

shouldUsePool

public boolean shouldUsePool()

blockingHandle

protected void blockingHandle(I2PSocket socket)