class ClientListenerRunner extends Object implements Runnable
| Modifier and Type | Field and Description |
|---|---|
protected boolean | _bindAllInterfacesWhether to bind on all interfaces |
protected RouterContext | _contextRouter context |
protected boolean | _listeningWhether the socket is currently listening |
protected Log | _logLogger for this class |
protected ClientManager | _managerClient manager |
protected int | _portPort to listen on |
protected boolean | _runningWhether the runner is running |
protected ServerSocket | _socketServer socket for accepting connections |
static String | BIND_ALL_INTERFACESProperty to control binding to all interfaces |
protected static int | CONNECT_TIMEOUTgive the i2cp client 5 seconds to show that they're really i2cp clients |
| Constructor and Description |
|---|
ClientListenerRunner(RouterContext context,
ClientManager manager,
int port)Construct a new client listener runner. |
| Modifier and Type | Method and Description |
|---|---|
protected ServerSocket | getServerSocket()Get a ServerSocket. |
boolean | isListening()Check if the listener is currently running and listening. |
void | run() |
protected void | runConnection(Socket socket)Handle the connection by passing it off to a ClientConnectionRunner |
protected void | runServer()Start up the socket listener, listens for connections, and
fires those connections off via runConnection. |
void | stopListening()Stop listening for connections. |
protected boolean | validate(Socket socket)Verify the first byte. |
protected final boolean _bindAllInterfaces
protected final RouterContext _context
protected volatile boolean _listening
protected final Log _log
protected final ClientManager _manager
protected final int _port
protected volatile boolean _running
protected ServerSocket _socket
public static final String BIND_ALL_INTERFACES
protected static final int CONNECT_TIMEOUT
public ClientListenerRunner(RouterContext context, ClientManager manager, int port)
context - the router contextmanager - the client managerport - the port numberprotected ServerSocket getServerSocket() throws IOException
IOException - if the socket cannot be createdpublic boolean isListening()
protected void runConnection(Socket socket)
ClientConnectionRunnersocket - the accepted socket connectionprotected void runServer()
runConnection.
This only returns if the socket cannot be opened or there is a catastrophic
failure.public void stopListening()
protected boolean validate(Socket socket)
socket - the socket