java.lang.Object
net.i2p.i2ptunnel.I2PTunnelRunner.StreamForwarder
- All Implemented Interfaces:
Runnable
- Enclosing class:
I2PTunnelRunner
Field Summary
Modifier and TypeFieldDescriptionprivate final ByteCachePooled buffer used for the copies.private final I2PTunnelRunner.SuccessCallbackRun when the stream ends normally.private ExceptionException that ended the forward, null until then.private booleanTrue once the stall read-timeout has been armed on the I2P socket.private final booleanTrue when copying toward I2P.private final StringDirection label for the logs.booleanFlag to signal this forwarder should stop.private final InputStreamStream the bytes are read from.private final OutputStreamStream the bytes are written to.Constructor Summary
ConstructorsConstructorDescriptionStreamForwarder(InputStream in, OutputStream out, boolean toI2P, I2PTunnelRunner.SuccessCallback cb) Forwards data between a local socket and the tunnel.Method Summary
All MethodsModifier and TypeMethodDescriptionThe exception that ended the forward, if any.voidrun()Pumps bytes between one socket and the I2P stream until either side closes.
Field Details
in
Stream the bytes are read from.out
Stream the bytes are written to.direction
Direction label for the logs._toI2P
private final boolean _toI2PTrue when copying toward I2P._cache
Pooled buffer used for the copies._callback
Run when the stream ends normally._failure
Exception that ended the forward, null until then.done
public volatile boolean doneFlag to signal this forwarder should stop._stallArmed
private boolean _stallArmedTrue once the stall read-timeout has been armed on the I2P socket.
Constructor Details
StreamForwarder
public StreamForwarder(InputStream in, OutputStream out, boolean toI2P, I2PTunnelRunner.SuccessCallback cb) Forwards data between a local socket and the tunnel.- Parameters:
in- the stream to read bytes fromout- the stream to write bytes totoI2P- true when forwarding from the local socket to the I2P streamcb- may be null, only used for toI2P == false
Method Details
run
getFailure
The exception that ended the forward, if any.- Returns:
- the exception that ended this direction, or null if it ran to completion