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:
@@ -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,12 +358,16 @@ 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
|
||||||
_tickInterval = new Interval() {
|
if (_tickInterval == null) {
|
||||||
public void expired () {
|
_tickInterval = new Interval() {
|
||||||
tick();
|
public void expired () {
|
||||||
}
|
tick();
|
||||||
};
|
}
|
||||||
_tickInterval.schedule(5000L, true);
|
};
|
||||||
|
_tickInterval.schedule(5000L, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user