Package net.i2p.router.client
Class ClientListenerRunner
java.lang.Object
net.i2p.router.client.ClientListenerRunner
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
SSLClientListenerRunner
class ClientListenerRunner extends Object implements Runnable
Listen for connections on the specified port, and toss them onto the client manager's
set of connections once they are established.
This is not used for internal (in-JVM) connections - see ClientManager and QueuedClientConnectionRunner.
Note that this is extended by SSLClientListenerRunner for SSL,
and by DomainClientListenerRunner in Android for domain sockets.
- Author:
- jrandom
-
Field Summary
Fields Modifier and Type Field Description protected boolean_bindAllInterfacesprotected RouterContext_contextprotected boolean_listeningprotected Log_logprotected ClientManager_managerprotected int_portprotected boolean_runningprotected ServerSocket_socketstatic StringBIND_ALL_INTERFACESprotected static intCONNECT_TIMEOUTgive the i2cp client 5 seconds to show that they're really i2cp clients -
Constructor Summary
Constructors Constructor Description ClientListenerRunner(RouterContext context, ClientManager manager, int port) -
Method Summary
Modifier and Type Method Description protected ServerSocketgetServerSocket()Get a ServerSocket.booleanisListening()voidrun()protected voidrunConnection(Socket socket)Handle the connection by passing it off to aClientConnectionRunnerprotected voidrunServer()Start up the socket listener, listens for connections, and fires those connections off viarunConnection.voidstopListening()protected booleanvalidate(Socket socket)Verify the first byte.
-
Field Details
-
_log
-
_context
-
_manager
-
_socket
-
_port
protected final int _port -
_bindAllInterfaces
protected final boolean _bindAllInterfaces -
_running
protected volatile boolean _running -
_listening
protected volatile boolean _listening -
BIND_ALL_INTERFACES
- See Also:
- Constant Field Values
-
CONNECT_TIMEOUT
protected static final int CONNECT_TIMEOUTgive the i2cp client 5 seconds to show that they're really i2cp clients- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
isListening
public boolean isListening() -
getServerSocket
Get a ServerSocket. Split out so it can be overridden for SSL.- Throws:
IOException- Since:
- 0.8.3
-
run
public void run() -
runServer
protected void runServer()Start up the socket listener, listens for connections, and fires those connections off viarunConnection. This only returns if the socket cannot be opened or there is a catastrophic failure. -
validate
Verify the first byte. -
runConnection
Handle the connection by passing it off to aClientConnectionRunner -
stopListening
public void stopListening()
-