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
This commit is contained in:
@@ -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;
|
package com.threerings.presents.client;
|
||||||
|
|
||||||
@@ -120,10 +120,7 @@ public class Communicator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop our ping interval
|
stopPingInterval();
|
||||||
if (_piid != -1) {
|
|
||||||
IntervalManager.remove(_piid);
|
|
||||||
}
|
|
||||||
|
|
||||||
// post a logoff message
|
// post a logoff message
|
||||||
postMessage(new LogoffRequest());
|
postMessage(new LogoffRequest());
|
||||||
@@ -235,6 +232,9 @@ public class Communicator
|
|||||||
// clear out our reader reference
|
// clear out our reader reference
|
||||||
_reader = null;
|
_reader = null;
|
||||||
|
|
||||||
|
// in case we haven't already done it.
|
||||||
|
stopPingInterval();
|
||||||
|
|
||||||
if (_writer == null) {
|
if (_writer == null) {
|
||||||
// there's no writer during authentication, so we may be
|
// there's no writer during authentication, so we may be
|
||||||
// responsible for closing the socket channel
|
// responsible for closing the socket channel
|
||||||
@@ -346,6 +346,17 @@ public class Communicator
|
|||||||
return (now - _lastWrite > PingRequest.PING_INTERVAL);
|
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
|
* Reads a new message from the socket (blocking until a message has
|
||||||
* arrived).
|
* arrived).
|
||||||
|
|||||||
Reference in New Issue
Block a user