From 59aec9d2897a4897ee0553aa5cf625495267cdae Mon Sep 17 00:00:00 2001 From: jrandom <jrandom> Date: Wed, 5 May 2004 03:36:18 +0000 Subject: [PATCH] expose the read timeout for the client and put the default read timeout back to -1 for the server (override via command line, etc) --- .../java/src/net/i2p/i2ptunnel/I2PTunnelClient.java | 6 ++++++ .../java/src/net/i2p/i2ptunnel/I2PTunnelServer.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java index ab0913695d..c88fc2f226 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java @@ -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); diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java index 03d4290c46..81aef16806 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java @@ -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); -- GitLab