java.lang.Object
net.i2p.sam.SAMStreamSession.SAMStreamSessionSocketReader
net.i2p.sam.SAMStreamSession.SAMv1StreamSessionSocketReader
net.i2p.sam.SAMv2StreamSession.SAMv2StreamSessionSocketReader
- 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 Summary
FieldsModifier and TypeFieldDescriptionprotected longMaximum bytes the reader may take before it blocks.protected booleanTrue when the receive byte cap is not enforced.protected longBytes received from the peer so far on this stream.Fields inherited from class SAMStreamSession.SAMStreamSessionSocketReader
i2pSocket, id, runningLock, stillRunningConstructor Summary
ConstructorsConstructorDescriptionSAMv2StreamSessionSocketReader(I2PSocket s, int id) Create a new SAM STREAM session socket reader.Method Summary
All MethodsMethods inherited from class SAMStreamSession.SAMv1StreamSessionSocketReader
stopRunningModifier and TypeMethodDescriptionvoidStop a SAM STREAM session socket reader thead immediately.
Field Details
nolimit
protected boolean nolimitTrue when the receive byte cap is not enforced.limit
protected long limitMaximum bytes the reader may take before it blocks.totalReceived
protected long totalReceivedBytes received from the peer so far on this stream.
Constructor Details
SAMv2StreamSessionSocketReader
Create a new SAM STREAM session socket reader.- Parameters:
s- Socket to be handledid- 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 blocksnolimit- 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:
runin interfaceRunnable- Overrides:
runin classSAMStreamSession.SAMv1StreamSessionSocketReader