ruffy: catch race-condition sending keep alive during disconnect.
This commit is contained in:
parent
03443f3358
commit
cccf6f175c
|
@ -277,11 +277,19 @@ public class Ruffy extends Service {
|
||||||
}
|
}
|
||||||
while(rtModeRunning)
|
while(rtModeRunning)
|
||||||
{
|
{
|
||||||
if(System.currentTimeMillis() > lastRtMessageSent +1000L) {
|
try {
|
||||||
log("sending keep alive");
|
if (System.currentTimeMillis() > lastRtMessageSent + 1000L) {
|
||||||
synchronized (rtSequenceSemaphore) {
|
log("sending keep alive");
|
||||||
rtSequence = Application.sendRTKeepAlive(rtSequence, btConn);
|
synchronized (rtSequenceSemaphore) {
|
||||||
lastRtMessageSent = System.currentTimeMillis();
|
rtSequence = Application.sendRTKeepAlive(rtSequence, btConn);
|
||||||
|
lastRtMessageSent = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (rtModeRunning) {
|
||||||
|
fail("Error sending keep alive while rtModeRunning is still true");
|
||||||
|
} else {
|
||||||
|
fail("Error sending keep alive. rtModeRunning is false, so this is most likely a race condition during disconnect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
|
|
Loading…
Reference in a new issue