Don't depend on presents

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6378 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Charlie Groves
2010-12-15 00:37:10 +00:00
parent f12887ae87
commit 68f8a577e9
2 changed files with 9 additions and 5 deletions
@@ -21,6 +21,8 @@
package com.threerings.nio; package com.threerings.nio;
import static com.threerings.NaryaLog.log;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
@@ -31,8 +33,6 @@ import java.nio.channels.Selector;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import static com.threerings.presents.Log.log;
/** /**
* Exposes selected keys from {@link Selector#selectedKeys()} as an Iterable, removing them from the * Exposes selected keys from {@link Selector#selectedKeys()} as an Iterable, removing them from the
* selected set as they're iterated over. * selected set as they're iterated over.
@@ -21,12 +21,12 @@
package com.threerings.nio.conman; package com.threerings.nio.conman;
import static com.threerings.NaryaLog.log;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.channels.SelectionKey; import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel; import java.nio.channels.SocketChannel;
import com.threerings.presents.net.PingRequest;
import static com.threerings.presents.Log.log;
/** /**
* Implements the net event handler interface to check for delinquency and manages a client * Implements the net event handler interface to check for delinquency and manages a client
@@ -34,6 +34,10 @@ import static com.threerings.presents.Log.log;
*/ */
public abstract class Connection implements NetEventHandler public abstract class Connection implements NetEventHandler
{ {
/** The number of milliseconds of idle upstream that are allowed to elapse before the client
* sends a ping message to the server to let it know that we're still alive. */
public static final long PING_INTERVAL = 60 * 1000L;
/** The key used by the NIO code to track this connection. */ /** The key used by the NIO code to track this connection. */
public SelectionKey selkey; public SelectionKey selkey;
@@ -147,7 +151,7 @@ public abstract class Connection implements NetEventHandler
public boolean checkIdle (long now) public boolean checkIdle (long now)
{ {
long idleMillis = now - _lastEvent; long idleMillis = now - _lastEvent;
if (idleMillis < PingRequest.PING_INTERVAL + LATENCY_GRACE) { if (idleMillis < PING_INTERVAL + LATENCY_GRACE) {
return false; return false;
} }
if (isClosed()) { if (isClosed()) {