net.i2p.sam
Class SAMMessageSession.SAMMessageSessionHandler

java.lang.Object
  extended by net.i2p.sam.SAMMessageSession.SAMMessageSessionHandler
All Implemented Interfaces:
java.lang.Runnable, I2PSessionListener
Enclosing class:
SAMMessageSession

public class SAMMessageSession.SAMMessageSessionHandler
extends java.lang.Object
implements java.lang.Runnable, I2PSessionListener

SAM message-based session handler, running in its own thread

Author:
human

Constructor Summary
SAMMessageSession.SAMMessageSessionHandler(java.io.InputStream destStream, java.util.Properties props)
          Create a new SAM message-based session handler
 
Method Summary
 void disconnected(I2PSession session)
          Notify the client that the session has been terminated
 void errorOccurred(I2PSession session, java.lang.String message, java.lang.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.
 void run()
           
 void stopRunning()
          Stop a SAM message-based session handling thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAMMessageSession.SAMMessageSessionHandler

public SAMMessageSession.SAMMessageSessionHandler(java.io.InputStream destStream,
                                                  java.util.Properties props)
                                           throws I2PSessionException
Create a new SAM message-based session handler

Parameters:
destStream - Input stream containing the destination keys
props - Properties to setup the I2P session
Throws:
I2PSessionException
Method Detail

stopRunning

public final void stopRunning()
Stop a SAM message-based session handling thread


run

public void run()
Specified by:
run in interface java.lang.Runnable

disconnected

public void disconnected(I2PSession session)
Description copied from interface: I2PSessionListener
Notify the client that the session has been terminated

Specified by:
disconnected in interface I2PSessionListener

errorOccurred

public void errorOccurred(I2PSession session,
                          java.lang.String message,
                          java.lang.Throwable error)
Description copied from interface: I2PSessionListener
Notify the client that some error occurred

Specified by:
errorOccurred in interface I2PSessionListener

messageAvailable

public void messageAvailable(I2PSession session,
                             int msgId,
                             long size)
Description copied from interface: I2PSessionListener
Instruct the client that the given session has received a message with size # of bytes.

Specified by:
messageAvailable in interface I2PSessionListener
Parameters:
session - session to notify
msgId - message number available
size - size of the message - why it's a long and not an int is a mystery

reportAbuse

public void reportAbuse(I2PSession session,
                        int severity)
Description copied from interface: I2PSessionListener
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.

Specified by:
reportAbuse in interface I2PSessionListener
Parameters:
session - session to report abuse to
severity - how bad the abuse is