All Implemented Interfaces:
Runnable, EventDispatcher

public class I2PTunnelDCCClientextends I2PTunnelClientBase
A standard client, using an existing socket manager. Targets a single destination and port. Naming resolution is delayed until connect time.
  • Field Details

    • _dest

      private final String _dest
      Destination of the DCC peer, resolved only at connect time.
    • _remotePort

      private final int _remotePort
      Port the DCC peer listens on.
    • _expires

      private long _expires
      When this client's tunnel stops being kept alive, in ms.
    • INBOUND_EXPIRE

      private static final long INBOUND_EXPIRE
      How long an inbound DCC tunnel is kept - 30 minutes.
      See Also:
    • INBOUND_STOP_EXPIRE

      private static final long INBOUND_STOP_EXPIRE
      How long after the last use an inbound DCC tunnel is stopped - 30 minutes.
      See Also:
    • CONNECT_START_EVENT

      public static final String CONNECT_START_EVENT
      Event fired when DCC connection starts.
      See Also:
    • CONNECT_STOP_EVENT

      public static final String CONNECT_STOP_EVENT
      Event fired when DCC connection stops.
      See Also:
  • Constructor Details

    • I2PTunnelDCCClient

      public I2PTunnelDCCClient(String dest, int localPort, int remotePort, Logging l, I2PSocketManager sktMgr, EventDispatcher notifyThis, I2PTunnel tunnel, long clientId) throws IllegalArgumentException
      Create an IRC DCC client tunnel, offering one outbound file transfer connection to dest:remotePort. As of 0.9.20 this is fast, and does NOT connect the manager to the router, or open the local socket. You MUST call startRunning() for that.
      Parameters:
      dest - the target, presumably b32
      localPort - if 0, use any port, get actual port selected with getLocalPort()
      remotePort - port on the remote IRC side that the transfer will use
      l - logging implementation, passed to the superclass for this client
      sktMgr - socket manager used to open the I2P socket and send on it
      notifyThis - dispatcher notified of the connect and stop events
      tunnel - the owning tunnel, supplying the router context and clock
      clientId - id handed to the superclass to tag jobs and log messages
      Throws:
      IllegalArgumentException - if the I2PTunnel does not contain valid config to contact the router
  • Method Details

    • clientConnectionRun

      protected void clientConnectionRun(Socket s)
      Accept one connection only.
      Specified by:
      clientConnectionRun in class I2PTunnelClientBase
      Parameters:
      s - the socket to manage
    • getExpires

      public long getExpires()
      Returns the expiration time for this DCC connection.
      Returns:
      the expiration time in milliseconds since epoch
    • getDest

      public String getDest()
      Returns the destination base32 address for this DCC connection.
      Returns:
      the destination Base32 address
    • getRemotePort

      public int getRemotePort()
      Returns the remote port for this DCC connection.
      Returns:
      the remote port number
    • stop

      public void stop()
      Stop listening for new sockets. We can't call super.close() as it kills all sockets in the sockMgr.