Passing in the timestamp that dictates idleness allows us to propagate the idle

duration a bit less far. And Ray will be pleased to know that we're doing much
less redundant arithmetic.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6385 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2010-12-16 02:18:53 +00:00
parent 6a45fec4ea
commit 74c2c77443
7 changed files with 31 additions and 37 deletions
@@ -90,8 +90,8 @@ public class DatagramChannelReader
public int handleEvent (long when) {
return _conMan.handleDatagram(channel, when);
}
public boolean checkIdle (long now) {
return false;// Can't be idle
public boolean checkIdle (long idleStamp) {
return false; // we can't be idle
}
public void becameIdle () {}
});
@@ -60,11 +60,10 @@ public class PresentsConnection extends Connection
* {@link PresentsConnectionManager} as <code>cmgr</code>.
*/
@Override
public void init (ConnectionManager cmgr, SocketChannel channel, long createStamp,
long idleTime)
public void init (ConnectionManager cmgr, SocketChannel channel, long createStamp)
throws IOException
{
super.init(cmgr, channel, createStamp, idleTime);
super.init(cmgr, channel, createStamp);
_pcmgr = (PresentsConnectionManager)cmgr;
}
@@ -307,7 +307,7 @@ public class PresentsConnectionManager extends ConnectionManager
// have the non-blocking connect process started
SocketChannel sockchan = SocketChannel.open();
sockchan.configureBlocking(false);
conn.init(this, sockchan, System.currentTimeMillis(), _idleTime);
conn.init(this, sockchan, System.currentTimeMillis());
_connectq.append(Tuple.newTuple(conn, new InetSocketAddress(hostname, port)));
}
@@ -346,8 +346,8 @@ public class PresentsConnectionManager extends ConnectionManager
}
return 0;
}
public boolean checkIdle (long now) {
return conn.checkIdle(now);
public boolean checkIdle (long idleStamp) {
return conn.checkIdle(idleStamp);
}
public void becameIdle () {
handleError(new IOException("Pending connection became idle."));
@@ -452,7 +452,7 @@ public class PresentsConnectionManager extends ConnectionManager
// construct a new running connection to handle this connections network traffic
// from here on out
PresentsConnection rconn = new PresentsConnection();
rconn.init(this, conn.getChannel(), iterStamp, _idleTime);
rconn.init(this, conn.getChannel(), iterStamp);
rconn.selkey = conn.selkey;
// we need to keep using the same object input and output streams from the