From 6cb3d605d7f4f63e50a02f694b52df77567368c9 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 5 Jun 2003 00:26:16 +0000 Subject: [PATCH] Be sure to unregister the interval, even if the the reader exits before we logoff. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2638 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/client/Communicator.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/presents/client/Communicator.java b/src/java/com/threerings/presents/client/Communicator.java index 97f5d5f9d..4e2ab7d05 100644 --- a/src/java/com/threerings/presents/client/Communicator.java +++ b/src/java/com/threerings/presents/client/Communicator.java @@ -1,5 +1,5 @@ // -// $Id: Communicator.java,v 1.28 2003/04/10 22:02:59 mdb Exp $ +// $Id: Communicator.java,v 1.29 2003/06/05 00:26:16 ray Exp $ package com.threerings.presents.client; @@ -120,10 +120,7 @@ public class Communicator return; } - // stop our ping interval - if (_piid != -1) { - IntervalManager.remove(_piid); - } + stopPingInterval(); // post a logoff message postMessage(new LogoffRequest()); @@ -235,6 +232,9 @@ public class Communicator // clear out our reader reference _reader = null; + // in case we haven't already done it. + stopPingInterval(); + if (_writer == null) { // there's no writer during authentication, so we may be // responsible for closing the socket channel @@ -346,6 +346,17 @@ public class Communicator return (now - _lastWrite > PingRequest.PING_INTERVAL); } + /** + * Stops our ping interval. + */ + protected void stopPingInterval () + { + if (_piid != -1) { + IntervalManager.remove(_piid); + _piid = -1; + } + } + /** * Reads a new message from the socket (blocking until a message has * arrived).