diff --git a/apps/BOB/nbproject/private/private.xml b/apps/BOB/nbproject/private/private.xml index ccaab1e5c..4f83e8d30 100644 --- a/apps/BOB/nbproject/private/private.xml +++ b/apps/BOB/nbproject/private/private.xml @@ -2,6 +2,7 @@ - file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/BOB.java + file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java + file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/MUXlisten.java diff --git a/apps/BOB/src/net/i2p/BOB/BOB.java b/apps/BOB/src/net/i2p/BOB/BOB.java index ee3f5937a..2c689f65d 100644 --- a/apps/BOB/src/net/i2p/BOB/BOB.java +++ b/apps/BOB/src/net/i2p/BOB/BOB.java @@ -256,11 +256,13 @@ public class BOB { listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST))); Socket server = null; listener.setSoTimeout(500); // .5 sec + while (spin.get()) { //DoCMDS connection; try { server = listener.accept(); + server.setKeepAlive(true); g = true; } catch (ConnectException ce) { g = false; diff --git a/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java b/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java index 85dcf5b41..4c186700f 100644 --- a/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java +++ b/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java @@ -102,6 +102,7 @@ public class I2PtoTCP implements Runnable { break die; } sock = new Socket(host, port); + sock.setKeepAlive(true); // make readers/writers in = sock.getInputStream(); out = sock.getOutputStream(); diff --git a/apps/BOB/src/net/i2p/BOB/TCPlistener.java b/apps/BOB/src/net/i2p/BOB/TCPlistener.java index 714ee1e7f..154e2a4d1 100644 --- a/apps/BOB/src/net/i2p/BOB/TCPlistener.java +++ b/apps/BOB/src/net/i2p/BOB/TCPlistener.java @@ -78,6 +78,7 @@ public class TCPlistener implements Runnable { while (lives.get()) { try { server = listener.accept(); + server.setKeepAlive(true); g = true; } catch (SocketTimeoutException ste) { g = false; diff --git a/history.txt b/history.txt index 11ae0d23d..bdfdbf910 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,10 @@ +2010-01-19 sponge + * Firewall fix for NTCP, where firewalls will forget a NAT relationship + on a stream... AKA setting keepalive. This should fix the stuck NTCP + issue that has been bothing zzz for years. + * Set keepalive on BOB connections too, since this will assist closing + the connections in the event of a crash on a client. + 2010-01-18 zzz * configclients.jsp: Fix add-new-client feature * Console: Add a tunnel share ratio estimate diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index be2f8c298..869f2a488 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 4; + public final static long BUILD = 5; /** for example "-test" */ public final static String EXTRA = "-rc"; diff --git a/router/java/src/net/i2p/router/transport/ntcp/EventPumper.java b/router/java/src/net/i2p/router/transport/ntcp/EventPumper.java index 89c12250c..82ec5719e 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/EventPumper.java +++ b/router/java/src/net/i2p/router/transport/ntcp/EventPumper.java @@ -418,6 +418,8 @@ public class EventPumper implements Runnable { try { chan.close(); } catch (IOException ioe) { } return; } + // BUGFIX for firewalls. --Sponge + chan.socket().setKeepAlive(true); SelectionKey ckey = chan.register(_selector, SelectionKey.OP_READ); NTCPConnection con = new NTCPConnection(_context, _transport, chan, ckey); @@ -436,6 +438,8 @@ public class EventPumper implements Runnable { if (_log.shouldLog(Log.DEBUG)) _log.debug("processing connect for " + key + " / " + con + ": connected? " + connected); if (connected) { + // BUGFIX for firewalls. --Sponge + chan.socket().setKeepAlive(true); con.setKey(key); con.outboundConnected(); _context.statManager().addRateData("ntcp.connectSuccessful", 1, 0);