class MessageHandler extends Object implements I2PSessionMuxedListener
I2PSession -> MessageHandler -> PacketHandler -> ConnectionPacketHandler -> MessageInputStream
| Constructor and Description |
|---|
MessageHandler(I2PAppContext ctx,
ConnectionManager mgr)Creates a new MessageHandler |
| Modifier and Type | Method and Description |
|---|---|
void | addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)Add a disconnect listener |
void | disconnected(I2PSession session)Notify the client that the session has been terminated
As of 0.9.54, this does not clear the listeners, so
they will be notified again after a subsequent connection and disconnection. |
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 | messageAvailable(I2PSession session,
int msgId,
long size,
int proto,
int fromPort,
int toPort)Instruct the client that the given session has received a message with
size # of bytes. |
void | removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)Remove a disconnect listener |
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. |
public MessageHandler(I2PAppContext ctx, ConnectionManager mgr)
ctx - the I2P app contextmgr - the connection managerpublic void addDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
lsnr - the listener to addpublic void disconnected(I2PSession session)
disconnected in interface I2PSessionListenerdisconnected in interface I2PSessionMuxedListenersession - that has been terminatedpublic void errorOccurred(I2PSession session, String message, Throwable error)
errorOccurred in interface I2PSessionListenererrorOccurred in interface I2PSessionMuxedListenersession - of the clientmessage - to send to the client about the errorerror - the actual errorpublic void messageAvailable(I2PSession session, int msgId, long size)
messageAvailable in interface I2PSessionListenermessageAvailable in interface I2PSessionMuxedListenersession - session to notifymsgId - message number availablesize - size of the messagepublic void messageAvailable(I2PSession session, int msgId, long size, int proto, int fromPort, int toPort)
messageAvailable in interface I2PSessionMuxedListenersession - session to notifymsgId - message number availablesize - size of the messageproto - 1-254 or 0 for unspecifiedfromPort - 1-65535 or 0 for unspecifiedtoPort - 1-65535 or 0 for unspecifiedpublic void removeDisconnectListener(I2PSocketManager.DisconnectListener lsnr)
lsnr - the listener to removepublic void reportAbuse(I2PSession session, int severity)
reportAbuse in interface I2PSessionListenerreportAbuse in interface I2PSessionMuxedListenersession - session to report abuse toseverity - how bad the abuse is