expose the read timeout for the client and put the default read timeout back to -1 for the server (override via command line, etc)

This commit is contained in:
jrandom
2004-05-05 03:36:18 +00:00
committed by zzz
parent 451f4c503d
commit 59aec9d289
2 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,8 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
private static final Log _log = new Log(I2PTunnelClient.class);
protected Destination dest;
private static final long DEFAULT_READ_TIMEOUT = -1; // 3*60*1000;
protected long readTimeout = DEFAULT_READ_TIMEOUT;
public I2PTunnelClient(int localPort, String destination, Logging l, boolean ownDest, EventDispatcher notifyThis) {
super(localPort, ownDest, l, notifyThis, "SynSender");
@ -45,9 +47,13 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
notifyEvent("openClientResult", "ok");
}
public void setReadTimeout(long ms) { readTimeout = ms; }
public long getReadTimeout() { return readTimeout; }
protected void clientConnectionRun(Socket s) {
try {
I2PSocket i2ps = createI2PSocket(dest);
i2ps.setReadTimeout(readTimeout);
new I2PTunnelRunner(s, i2ps, sockLock, null);
} catch (Exception ex) {
_log.info("Error connecting", ex);

View File

@ -40,8 +40,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
private Logging l;
private static final long DEFAULT_READ_TIMEOUT = -1; // 3*60*1000;
/** default timeout to 3 minutes - override if desired */
private long readTimeout = 3*60*1000;
private long readTimeout = DEFAULT_READ_TIMEOUT;
public I2PTunnelServer(InetAddress host, int port, String privData, Logging l, EventDispatcher notifyThis) {
super(host + ":" + port + " <- " + privData, notifyThis);