All Implemented Interfaces:
Runnable
Enclosing class:
SAMv2StreamSession

public class SAMv2StreamSession.SAMv2StreamSessionSocketReaderextends SAMStreamSession.SAMv1StreamSessionSocketReader
SAM STREAM socket reader, running in its own thread. It forwards forward data to/from an I2P socket.
  • Field Details

    • nolimit

      protected boolean nolimit
      True when the receive byte cap is not enforced.
    • limit

      protected long limit
      Maximum bytes the reader may take before it blocks.
    • totalReceived

      protected long totalReceived
      Bytes received from the peer so far on this stream.
  • Constructor Details

    • SAMv2StreamSessionSocketReader

      public SAMv2StreamSessionSocketReader(I2PSocket s, int id) throws IOException
      Create a new SAM STREAM session socket reader.
      Parameters:
      s - Socket to be handled
      id - Unique id assigned to the handler
      Throws:
      IOException - never thrown here, since the constructor only forwards to the superclass
  • Method Details

    • setLimit

      public void setLimit(long limit, boolean nolimit)
      Applies a new receive byte cap and wakes a blocked reader.
      Parameters:
      limit - the number of bytes the reader may take before it blocks
      nolimit - true to drop the byte cap entirely, false to enforce the limit
    • run

      public void run()
      Reads from the socket and forwards the data to the client connection.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class SAMStreamSession.SAMv1StreamSessionSocketReader