* 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.
This commit is contained in:
sponge
2010-01-19 08:54:40 +00:00
parent 00fa3806d8
commit 5c595ef289
7 changed files with 18 additions and 2 deletions

View File

@@ -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";

View File

@@ -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);