ruffy: catch race-condition sending keep alive during disconnect.
This commit is contained in:
parent
03443f3358
commit
cccf6f175c
1 changed files with 13 additions and 5 deletions
|
@ -277,6 +277,7 @@ public class Ruffy extends Service {
|
||||||
}
|
}
|
||||||
while(rtModeRunning)
|
while(rtModeRunning)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
if (System.currentTimeMillis() > lastRtMessageSent + 1000L) {
|
if (System.currentTimeMillis() > lastRtMessageSent + 1000L) {
|
||||||
log("sending keep alive");
|
log("sending keep alive");
|
||||||
synchronized (rtSequenceSemaphore) {
|
synchronized (rtSequenceSemaphore) {
|
||||||
|
@ -284,6 +285,13 @@ public class Ruffy extends Service {
|
||||||
lastRtMessageSent = System.currentTimeMillis();
|
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{
|
||||||
Thread.sleep(500);}catch(Exception e){/*ignore*/}
|
Thread.sleep(500);}catch(Exception e){/*ignore*/}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue