net.i2p.i2ptunnel
Class I2PTunnelRunner
java.lang.Object
java.lang.Thread
net.i2p.util.I2PThread
net.i2p.util.I2PAppThread
net.i2p.i2ptunnel.I2PTunnelRunner
- All Implemented Interfaces:
- Runnable, I2PSocket.SocketErrorListener
- Direct Known Subclasses:
- I2PTunnelHTTPClientRunner
public class I2PTunnelRunner
- extends I2PAppThread
- implements I2PSocket.SocketErrorListener
Constructor Summary |
I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
byte[] initialSocketData,
List<I2PSocket> sockList)
|
I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
byte[] initialSocketData,
List<I2PSocket> sockList,
Runnable onTimeout)
Starts itself |
I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
List<I2PSocket> sockList)
|
I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
List<I2PSocket> sockList,
Runnable onTimeout)
|
Method Summary |
protected void |
close(OutputStream out,
InputStream in,
OutputStream i2pout,
InputStream i2pin,
Socket s,
I2PSocket i2ps,
Thread t1,
Thread t2)
|
void |
errorOccurred()
An error occurred communicating with the peer. |
long |
getLastActivityOn()
Deprecated. unused |
protected InputStream |
getSocketIn()
|
protected OutputStream |
getSocketOut()
|
long |
getStartedOn()
When this runner started up transferring data |
boolean |
isFinished()
Deprecated. unused |
void |
run()
private void log(int level, String msg) { log(level, msg, null); }
private void log(int level, String msg, Throwable t) {
// we cant assume log is created
if (_log == null) _log = new Log(I2PThread.class);
if (_log.shouldLog(level))
_log.log(level, msg, t);
} |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
_log
protected final Log _log
MAX_PACKET_SIZE
static int MAX_PACKET_SIZE
- max bytes streamed in a packet - smaller ones might be filled
up to this size. Larger ones are not split (at least not on
Sun's impl of BufferedOutputStream), but that is the streaming
api's job...
NETWORK_BUFFER_SIZE
static final int NETWORK_BUFFER_SIZE
finished
boolean finished
I2PTunnelRunner
public I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
List<I2PSocket> sockList)
I2PTunnelRunner
public I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
byte[] initialSocketData,
List<I2PSocket> sockList)
I2PTunnelRunner
public I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
List<I2PSocket> sockList,
Runnable onTimeout)
I2PTunnelRunner
public I2PTunnelRunner(Socket s,
I2PSocket i2ps,
Object slock,
byte[] initialI2PData,
byte[] initialSocketData,
List<I2PSocket> sockList,
Runnable onTimeout)
- Starts itself
- Parameters:
slock
- the socket lock, non-nullinitialI2PData
- may be nullinitialSocketData
- may be nullsockList
- may be null. Caller must add i2ps to the list! It will be removed here on completion.
Will synchronize on slock when removing.onTimeout
- May be null. If non-null and no data (except initial data) was sent or received,
it will be run before closing s.
isFinished
public boolean isFinished()
- Deprecated. unused
- have we closed at least one (if not both) of the streams
[aka we're done running the streams]?
getLastActivityOn
public long getLastActivityOn()
- Deprecated. unused
- When was the last data for this runner sent or received?
- Returns:
- date (ms since the epoch), or -1 if no data has been transferred yet
getStartedOn
public long getStartedOn()
- When this runner started up transferring data
getSocketIn
protected InputStream getSocketIn()
throws IOException
- Throws:
IOException
getSocketOut
protected OutputStream getSocketOut()
throws IOException
- Throws:
IOException
run
public void run()
- Description copied from class:
I2PThread
- private void log(int level, String msg) { log(level, msg, null); }
private void log(int level, String msg, Throwable t) {
// we cant assume log is created
if (_log == null) _log = new Log(I2PThread.class);
if (_log.shouldLog(level))
_log.log(level, msg, t);
}
- Specified by:
run
in interface Runnable
- Overrides:
run
in class I2PThread
close
protected void close(OutputStream out,
InputStream in,
OutputStream i2pout,
InputStream i2pin,
Socket s,
I2PSocket i2ps,
Thread t1,
Thread t2)
throws InterruptedException
- Throws:
InterruptedException
errorOccurred
public void errorOccurred()
- Description copied from interface:
I2PSocket.SocketErrorListener
- An error occurred communicating with the peer.
- Specified by:
errorOccurred
in interface I2PSocket.SocketErrorListener