Indicate whether we rejected an attempt to logon because we're still in

the throes of a previous connection. Also don't spuriously recreate our
ticker because it's very possible for logon() to be called and not
logoff(), logon() might fail, for example.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3321 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-01-28 05:03:37 +00:00
parent 44be1bda18
commit 56417cdb0a
@@ -339,12 +339,15 @@ public class Client
/** /**
* Requests that this client connect and logon to the server with * Requests that this client connect and logon to the server with
* which it was previously configured. * which it was previously configured.
*
* @return false if we're already logged on, true if a logon attempt
* was initiated.
*/ */
public synchronized void logon () public synchronized boolean logon ()
{ {
// if we have a communicator reference, we're already logged on // if we have a communicator reference, we're already logged on
if (_comm != null) { if (_comm != null) {
return; return false;
} }
// otherwise create a new communicator instance and start it up. // otherwise create a new communicator instance and start it up.
@@ -355,6 +358,7 @@ public class Client
// register an interval that we'll use to keep the clock synced // register an interval that we'll use to keep the clock synced
// and to send pings when appropriate // and to send pings when appropriate
if (_tickInterval == null) {
_tickInterval = new Interval() { _tickInterval = new Interval() {
public void expired () { public void expired () {
tick(); tick();
@@ -363,6 +367,9 @@ public class Client
_tickInterval.schedule(5000L, true); _tickInterval.schedule(5000L, true);
} }
return true;
}
/** /**
* Requests that the client log off of the server to which it is * Requests that the client log off of the server to which it is
* connected. * connected.