All Known Subinterfaces:
I2PSessionMuxedListener
All Known Implementing Classes:
I2PSessionDemultiplexer, I2PSessionDemultiplexer.NoPortsListener, I2PSource.Listener, KRPC, MasterSession, MessageHandler, SAMMessageSession.SAMMessageSessionHandler, TorrentKRPC, UDPTrackerClient

public interface I2PSessionListener
Define a means for the router to asynchronously notify the client that a new message is available or the router is under attack.

A client must implement and register this via addSessionListener() to receive messages.

If you wish to get notification of the protocol, from port, and to port, or wish to get notification of certain protocols and ports only, you must use I2PSessionMuxedListener and addMuxedSessionListener() instead.

  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    void
    Notify the client that the session has been terminated.
    void
    errorOccurred(I2PSession session, String message, Throwable error)
    Notify the client that some error occurred.
    void
    messageAvailable(I2PSession session, int msgId, long size)
    Instruct the client that the given session has received a message with size # of bytes.
    void
    reportAbuse(I2PSession session, int severity)
    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.
  • Method Details

    • messageAvailable

      void messageAvailable(I2PSession session, int msgId, long size)
      Instruct the client that the given session has received a message with size # of bytes.

      After this is called, the client should call receiveMessage(msgId). A message can be dropped without being read by calling discardMessage(msgId), which avoids the decompression cost. If the client does not claim the message, the session drops it on a later pass of its unclaimed-message sweep (every 60 seconds) and logs a warning naming the message ID.

      Parameters:
      session - session to notify
      msgId - message number available
      size - size of the message payload in bytes. The I2CP payload size is an int internally and is widened to long here, so the value is never negative
    • reportAbuse

      void reportAbuse(I2PSession session, int severity)
      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.

      Unused. Not fully implemented.

      Parameters:
      session - session to report abuse to
      severity - how bad the abuse is
    • disconnected

      void disconnected(I2PSession session)
      Notify the client that the session has been terminated.
      Parameters:
      session - the session that was terminated
    • errorOccurred

      void errorOccurred(I2PSession session, String message, Throwable error)
      Notify the client that some error occurred.
      Parameters:
      session - the session that reported the error
      message - a human-readable description of the error
      error - the cause, non-null