From ca82921db0bc4f3e0ef2a746482a978bf3c4772e Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Wed, 20 Apr 2011 04:56:48 +0000 Subject: [PATCH] Clear the handler reference when we replace the connection. For some reason, it seems like we're still getting messages from old connections. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6627 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/PresentsSession.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/threerings/presents/server/PresentsSession.java b/src/main/java/com/threerings/presents/server/PresentsSession.java index 5beac1e9f..cad364da5 100644 --- a/src/main/java/com/threerings/presents/server/PresentsSession.java +++ b/src/main/java/com/threerings/presents/server/PresentsSession.java @@ -835,12 +835,17 @@ public class PresentsSession */ protected synchronized void setConnection (PresentsConnection conn) { - // if our connection is being cleared out, record the amount of time we were connected to - // our total connected time long now = System.currentTimeMillis(); - if (_conn != null && conn == null) { - _connectTime += ((now - _networkStamp) / 1000); - _messagesDropped = 0; + if (_conn != null) { + // if our connection is being cleared out, record the amount of time we were connected + // to our total connected time + if (conn == null) { + _connectTime += ((now - _networkStamp) / 1000); + _messagesDropped = 0; + } + + // make damn sure we don't get any more messages from the old connection + _conn.setMessageHandler(null); } // keep a handle to the new connection