com.aelitis.azureus.core.networkmanager.impl.tcp
Class TCPConnectionManager

java.lang.Object
  extended by com.aelitis.azureus.core.networkmanager.impl.tcp.TCPConnectionManager

public class TCPConnectionManager
extends java.lang.Object

Manages new connection establishment and ended connection termination.


Nested Class Summary
static interface TCPConnectionManager.ConnectListener
          Listener for notification of connection establishment.
 
Field Summary
static int MAX_SIMULTANIOUS_CONNECT_ATTEMPTS
           
 
Constructor Summary
TCPConnectionManager()
           
 
Method Summary
 void cancelRequest(TCPConnectionManager.ConnectListener listener_key)
          Cancel a pending new connection request.
 void closeConnection(java.nio.channels.SocketChannel channel)
          Close the given connection.
 void closeConnection(java.nio.channels.SocketChannel channel, int delay)
           
 int getMaxOutboundPermitted()
           
 void requestNewConnection(java.net.InetSocketAddress address, TCPConnectionManager.ConnectListener listener, int priority)
          Request that a new connection be made out to the given address.
 void requestNewConnection(java.net.InetSocketAddress address, TCPConnectionManager.ConnectListener listener, int connect_timeout, int priority)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_SIMULTANIOUS_CONNECT_ATTEMPTS

public static int MAX_SIMULTANIOUS_CONNECT_ATTEMPTS
Constructor Detail

TCPConnectionManager

public TCPConnectionManager()
Method Detail

getMaxOutboundPermitted

public int getMaxOutboundPermitted()

requestNewConnection

public void requestNewConnection(java.net.InetSocketAddress address,
                                 TCPConnectionManager.ConnectListener listener,
                                 int priority)
Request that a new connection be made out to the given address.

Parameters:
address - remote ip+port to connect to
listener - to receive notification of connect attempt success/failure

requestNewConnection

public void requestNewConnection(java.net.InetSocketAddress address,
                                 TCPConnectionManager.ConnectListener listener,
                                 int connect_timeout,
                                 int priority)

closeConnection

public void closeConnection(java.nio.channels.SocketChannel channel)
Close the given connection.

Parameters:
channel - to close

closeConnection

public void closeConnection(java.nio.channels.SocketChannel channel,
                            int delay)

cancelRequest

public void cancelRequest(TCPConnectionManager.ConnectListener listener_key)
Cancel a pending new connection request.

Parameters:
listener_key - used in the initial connect request