From 68f8a577e9af1cebf488996553287e3b67e755d9 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Wed, 15 Dec 2010 00:37:10 +0000 Subject: [PATCH] Don't depend on presents git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6378 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/main/java/com/threerings/nio/SelectorIterable.java | 4 ++-- .../java/com/threerings/nio/conman/Connection.java | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/threerings/nio/SelectorIterable.java b/src/main/java/com/threerings/nio/SelectorIterable.java index 2bdcf987d..276d4fbaa 100644 --- a/src/main/java/com/threerings/nio/SelectorIterable.java +++ b/src/main/java/com/threerings/nio/SelectorIterable.java @@ -21,6 +21,8 @@ package com.threerings.nio; +import static com.threerings.NaryaLog.log; + import java.util.Collections; import java.util.Iterator; import java.util.Set; @@ -31,8 +33,6 @@ import java.nio.channels.Selector; 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 * selected set as they're iterated over. diff --git a/src/main/java/com/threerings/nio/conman/Connection.java b/src/main/java/com/threerings/nio/conman/Connection.java index a417a1933..29492dab2 100644 --- a/src/main/java/com/threerings/nio/conman/Connection.java +++ b/src/main/java/com/threerings/nio/conman/Connection.java @@ -21,12 +21,12 @@ package com.threerings.nio.conman; +import static com.threerings.NaryaLog.log; + import java.io.IOException; import java.net.InetAddress; import java.nio.channels.SelectionKey; 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 @@ -34,6 +34,10 @@ import static com.threerings.presents.Log.log; */ 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. */ public SelectionKey selkey; @@ -147,7 +151,7 @@ public abstract class Connection implements NetEventHandler public boolean checkIdle (long now) { long idleMillis = now - _lastEvent; - if (idleMillis < PingRequest.PING_INTERVAL + LATENCY_GRACE) { + if (idleMillis < PING_INTERVAL + LATENCY_GRACE) { return false; } if (isClosed()) {