Class I2PSource.Listener

java.lang.Object
net.i2p.i2ptunnel.udp.I2PSource.Listener
All Implemented Interfaces:
I2PSessionListener, I2PSessionMuxedListener
Enclosing class:
I2PSource

protected class I2PSource.Listener extends Object implements I2PSessionMuxedListener
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Notify the client that the session has been terminated.
    void
    Notify the client that some error occurred.
    void
    messageAvailable(I2PSession sess, int id, long size)
    Will be called only if you register via setSessionListener() or addSessionListener().
    void
    messageAvailable(I2PSession session, int id, long size, int proto, int fromPort, int toPort)
    Instruct the client that the given session has received a message Will be called only if you register via addMuxedSessionListener().
    void
    reportAbuse(I2PSession arg0, int arg1)
    Instruct the client that the session specified seems to be under attack and that the client may wish to move its destination to another router.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Listener

      protected Listener()
  • Method Details

    • messageAvailable

      public void messageAvailable(I2PSession sess, int id, long size)
      Description copied from interface: I2PSessionMuxedListener
      Will be called only if you register via setSessionListener() or addSessionListener(). And if you are doing that, just use I2PSessionListener. If you register via addSessionListener(), this will be called only for the proto(s) and toport(s) you register for. After this is called, the client should call receiveMessage(msgId). There is currently no method for the client to reject the message. If the client does not call receiveMessage() within a timeout period (currently 30 seconds), the session will delete the message and log an error.
      Specified by:
      messageAvailable in interface I2PSessionListener
      Specified by:
      messageAvailable in interface I2PSessionMuxedListener
      Parameters:
      sess - session to notify
      id - message number available
      size - size of the message - why it's a long and not an int is a mystery
    • messageAvailable

      public void messageAvailable(I2PSession session, int id, long size, int proto, int fromPort, int toPort)
      Description copied from interface: I2PSessionMuxedListener
      Instruct the client that the given session has received a message Will be called only if you register via addMuxedSessionListener(). Will be called only for the proto(s) and toport(s) you register for. After this is called, the client should call receiveMessage(msgId). There is currently no method for the client to reject the message. If the client does not call receiveMessage() within a timeout period (currently 30 seconds), the session will delete the message and log an error. Only one listener is called for a given message, even if more than one have registered. See I2PSessionDemultiplexer for details.
      Specified by:
      messageAvailable in interface I2PSessionMuxedListener
      Parameters:
      session - session to notify
      id - message number available
      size - size of the message - why it's a long and not an int is a mystery
      proto - 1-254 or 0 for unspecified
      fromPort - 1-65535 or 0 for unspecified
      toPort - 1-65535 or 0 for unspecified
      Since:
      0.9.53
    • reportAbuse

      public void reportAbuse(I2PSession arg0, int arg1)
      Description copied from interface: I2PSessionMuxedListener
      Instruct the client that the session specified seems to be under attack and that the client may wish to move its destination to another router. All registered listeners will be called. Unused. Not fully implemented.
      Specified by:
      reportAbuse in interface I2PSessionListener
      Specified by:
      reportAbuse in interface I2PSessionMuxedListener
      Parameters:
      arg0 - session to report abuse to
      arg1 - how bad the abuse is
    • disconnected

      public void disconnected(I2PSession arg0)
      Description copied from interface: I2PSessionMuxedListener
      Notify the client that the session has been terminated. All registered listeners will be called.
      Specified by:
      disconnected in interface I2PSessionListener
      Specified by:
      disconnected in interface I2PSessionMuxedListener
    • errorOccurred

      public void errorOccurred(I2PSession arg0, String arg1, Throwable arg2)
      Description copied from interface: I2PSessionMuxedListener
      Notify the client that some error occurred. All registered listeners will be called.
      Specified by:
      errorOccurred in interface I2PSessionListener
      Specified by:
      errorOccurred in interface I2PSessionMuxedListener
      Parameters:
      arg2 - can be null? or not?