Package net.i2p.client
Interface I2PSessionListener
- All Known Subinterfaces:
I2PSessionMuxedListener
- All Known Implementing Classes:
I2PSessionDemultiplexer
,I2PSource.Listener
,KRPC
,MasterSession
,MessageHandler
,UDPIOthread
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.
- Author:
- jrandom
-
Method Summary
Modifier and Type Method Description void
disconnected(I2PSession session)
Notify the client that the session has been terminatedvoid
errorOccurred(I2PSession session, String message, Throwable error)
Notify the client that some error occurredvoid
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
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). 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.- Parameters:
session
- session to notifymsgId
- message number availablesize
- size of the message - why it's a long and not an int is a mystery
-
reportAbuse
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 toseverity
- how bad the abuse is
-
disconnected
Notify the client that the session has been terminated -
errorOccurred
Notify the client that some error occurred- Parameters:
error
- can be null? or not?
-