RuffyScripter: only set connected variable in rtConnected, rtDisconnected.

Hopefully fixes intermittent failures to close the connection, as
idleDisconnectMonitorThread sometimes fails to disconnect
because connected == false.
This commit is contained in:
Johannes Mockenhaupt 2017-07-19 14:06:37 +02:00
parent e322b15e1c
commit a1564d5bb7
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -70,7 +70,6 @@ public class RuffyScripter {
// don't disconnect too frequently, confuses ruffy? // don't disconnect too frequently, confuses ruffy?
&& now > lastDisconnect + 15 * 1000) { && now > lastDisconnect + 15 * 1000) {
log.debug("Disconnecting after " + (connectionTimeOutMs / 1000) + "s inactivity timeout"); log.debug("Disconnecting after " + (connectionTimeOutMs / 1000) + "s inactivity timeout");
connected = false;
lastDisconnect = now; lastDisconnect = now;
ruffyService.doRTDisconnect(); ruffyService.doRTDisconnect();
SystemClock.sleep(1000); SystemClock.sleep(1000);
@ -295,7 +294,6 @@ public class RuffyScripter {
// waitForMenuUpdate times out after 60s and throws a CommandException // waitForMenuUpdate times out after 60s and throws a CommandException
waitForMenuUpdate(); waitForMenuUpdate();
} }
connected = true;
} catch (RemoteException e) { } catch (RemoteException e) {
throw new CommandException().exception(e).message("Unexpected exception while initiating/restoring pump connection"); throw new CommandException().exception(e).message("Unexpected exception while initiating/restoring pump connection");
} }