I2PTunnel:

- Fix bug that left server acceptor thread running after close
- Add destroy() methods to release all resources when closing a tunnel for good,
  particularly the streaming timer threads
- Use COWAL to prevent concurrency problems
- Javadocs
Streaming:
- Don't return null from accept() any more; actually throw
  ConnectException as the javadocs have always specified
- Throw ConnectException from accept() if interrupted; previously caught and ignored
- Throw exceptions from ConnectionHandler.accept(), not higher up
- Close ServerSocket when ConnectionManager is shut down
- Synchronize setActive(), clear queue when starting to accept,
  better handling of calls that don't change state
- Javadocs
ConfigClientsHelper: Call isPluginRunning() less often
PluginStarter: Simplify detection of active threads

Above changes mostly in support of zzzot plugin implementing ClientApp
and being able to shut down completely so there are no threads
in its thread group, so /configclients will all show status as stopped.
Previously, the I2PTunnelServer acceptor thread and
one or more streaming timer threads would remain.
This commit is contained in:
zzz
2014-11-13 20:12:55 +00:00
parent 0773a30578
commit 2f2aa7f5a8
16 changed files with 283 additions and 76 deletions

View File

@@ -20,14 +20,15 @@ public interface I2PServerSocket {
* Waits for the next socket connecting. If a remote user tried to make a
* connection and the local application wasn't .accept()ing new connections,
* they should get refused (if .accept() doesnt occur in some small period).
* Warning - unlike regular ServerSocket, may return null.
* Warning - unlike regular ServerSocket, may return null (through 0.9.16 only).
*
* @return a connected I2PSocket OR NULL
* @return a connected I2PSocket OR NULL through 0.9.16; never null as of 0.9.17
*
* @throws I2PException if there is a problem with reading a new socket
* from the data available (aka the I2PSession closed, etc)
* @throws ConnectException if the I2PServerSocket is closed
* @throws SocketTimeoutException
* from the data available (e.g. the I2PSession is closed)
* @throws ConnectException if the I2PServerSocket is closed, or if interrupted.
* Not actually thrown through 0.9.16; thrown as of 0.9.17
* @throws SocketTimeoutException if a timeout was previously set with setSoTimeout and the timeout has been reached.
*/
public I2PSocket accept() throws I2PException, ConnectException, SocketTimeoutException;

View File

@@ -57,6 +57,13 @@ public interface I2PSocketManager {
*/
public I2PSocketOptions getDefaultOptions();
/**
* Returns non-null socket.
* This method does not throw exceptions, but methods on the returned socket
* may throw exceptions if the socket or socket manager is closed.
*
* @return non-null
*/
public I2PServerSocket getServerSocket();
/**