From f60713de17970c1fd79d1531e84b84fd715c05ad Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 3 Nov 2008 23:00:07 +0000 Subject: [PATCH] Between the time that we're shutdown and the time that we finally exit, do not accept new connections or read incoming messages from any of our extant connections. Do send outgoing messages to those connections, but nothing else. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5493 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/net/ConnectionManager.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/java/com/threerings/presents/server/net/ConnectionManager.java b/src/java/com/threerings/presents/server/net/ConnectionManager.java index 1fc1716ee..1c9616246 100644 --- a/src/java/com/threerings/presents/server/net/ConnectionManager.java +++ b/src/java/com/threerings/presents/server/net/ConnectionManager.java @@ -255,7 +255,7 @@ public class ConnectionManager extends LoopingThread report.append(avgOut).append(" avg size, "); report.append(bytesOut*1000/sinceLast).append(" bps\n"); } - + @Override // from LoopingThread public boolean isRunning () { @@ -446,6 +446,15 @@ public class ConnectionManager extends LoopingThread // send any messages that are waiting on the outgoing overflow and message queues sendOutgoingMessages(iterStamp); + // if we have been shutdown, but we're stick around because the DObjectManager is still + // running (and we want to deliver any outgoing events queued up during shutdown), then we + // stop here, because we've delivered outgoing events on this tick and all that remains + // below is accepting new connections and receiving incoming messages, neither of which we + // want to do during the shutdown process + if (!super.isRunning()) { + return; + } + // check for connections that have completed authentication AuthingConnection conn; while ((conn = _authq.getNonBlocking()) != null) { @@ -859,7 +868,7 @@ public class ConnectionManager extends LoopingThread if (!isRunning()) { log.warning("Posting message to inactive connection manager", new Exception()); } - + // sanity check if (conn == null || msg == null) { log.warning("postMessage() bogosity", "conn", conn, "msg", msg, new Exception());