class ConnectionHandler extends Object
| Constructor and Description |
|---|
ConnectionHandler(I2PAppContext context,
ConnectionManager mgr,
SimpleTimer2 timer)Creates a new instance of ConnectionHandler |
| Modifier and Type | Method and Description |
|---|---|
Connection | accept(long timeoutMs)Receive an incoming connection (built from a received SYN)
Non-SYN packets with a zero SendStreamID may also be queued here so
that they don't get thrown away while the SYN packet before it is queued. |
boolean | getActive()Check if this handler is actively accepting new connections. |
void | receiveNewSyn(Packet packet)Non-SYN packets with a zero SendStreamID may also be queued here so
that they don't get thrown away while the SYN packet before it is queued. |
(package private) void | setAcceptTimeout(int ms) |
void | setActive(boolean active)Set whether this handler is actively accepting new connections. |
void | setRestartPending()The router told us it's going to restart. |
public ConnectionHandler(I2PAppContext context, ConnectionManager mgr, SimpleTimer2 timer)
public Connection accept(long timeoutMs) throws RouterRestartException, ConnectException, SocketTimeoutException
timeoutMs - max amount of time to wait for a connection (if less
than 1ms, wait indefinitely)RouterRestartException - (extends I2PException) if the router is apparently restarting, since 0.9.34ConnectException - since 0.9.17, returned null before;
if the I2PServerSocket is closed, or if interrupted.SocketTimeoutException - since 0.9.17, returned null before;
if a timeout was previously set with setSoTimeout and the timeout has been reached.public boolean getActive()
public void receiveNewSyn(Packet packet)
void setAcceptTimeout(int ms)
public void setActive(boolean active)
active - true to accept connections, false to stoppublic void setRestartPending()