Class I2PTunnelTask

java.lang.Object
net.i2p.util.EventDispatcherImpl
net.i2p.i2ptunnel.I2PTunnelTask
All Implemented Interfaces:
EventDispatcher
Direct Known Subclasses:
I2PTunnelClientBase, I2PTunnelServer, I2PTunnelUDPClientBase, I2PTunnelUDPServerBase

public abstract class I2PTunnelTask extends EventDispatcherImpl
Either a Server or a Client. Use caution if extending externally. This class should be maintained as a stable API, but ask to be sure. Note that there is no startRunning() method, however all extending classes implement one.
  • Field Details

    • open

      protected volatile boolean open
  • Constructor Details

  • Method Details

    • setTunnel

      public void setTunnel(I2PTunnel pTunnel)
      for apps that use multiple I2PTunnel instances
    • getTunnel

      public I2PTunnel getTunnel()
    • getId

      public int getId()
    • isOpen

      public boolean isOpen()
    • setId

      public void setId(int id)
    • setName

      protected void setName(String name)
    • routerDisconnected

      protected void routerDisconnected()
    • close

      public abstract boolean close(boolean forced)
      Note that the tunnel can be reopened after this by calling startRunning(). This may not release all resources. In particular, the I2PSocketManager remains and it may have timer threads that continue running. To release all resources permanently, call destroy().
      Returns:
      success
    • destroy

      public boolean destroy()
      Note that the tunnel cannot be reopened after this by calling startRunning(), as it may destroy the underlying socket manager, depending on implementation. This should release all resources. The implementation here simply calls close(true). Extending classes should override to release all resources.
      Returns:
      success
      Since:
      0.9.17
    • optionsUpdated

      public void optionsUpdated(I2PTunnel tunnel)
      Notify the task that I2PTunnel's options have been updated. Extending classes should override and call I2PTunnel.getClientOptions(), then update the I2PSocketManager. Does nothing here.
      Since:
      0.9.1
    • connected

      public void connected(I2PSession session)
      For tasks that don't call I2PTunnel.addSession() directly
      Since:
      0.8.13
    • disconnected

      public void disconnected(I2PSession session)
    • errorOccurred

      public void errorOccurred(I2PSession session, String message, Throwable error)
      Does nothing here. Extending classes may override.
    • reportAbuse

      public void reportAbuse(I2PSession session, int severity)
      Does nothing here. Extending classes may override.
    • toString

      public String toString()
      Overrides:
      toString in class Object