mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Return safely if destroy() is called before start().
This commit is contained in:
@@ -90,7 +90,7 @@ class ContactMailboxDownloadWorker implements MailboxWorker,
|
|||||||
LOG.info("Started");
|
LOG.info("Started");
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
// Don't allow the worker to be reused
|
// Don't allow the worker to be reused
|
||||||
if (state != State.CREATED) throw new IllegalStateException();
|
if (state != State.CREATED) return;
|
||||||
state = State.CONNECTIVITY_CHECK;
|
state = State.CONNECTIVITY_CHECK;
|
||||||
}
|
}
|
||||||
// Avoid leaking observer in case destroy() is called concurrently
|
// Avoid leaking observer in case destroy() is called concurrently
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class MailboxUploadWorker implements MailboxWorker, ConnectivityObserver,
|
|||||||
LOG.info("Started");
|
LOG.info("Started");
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
// Don't allow the worker to be reused
|
// Don't allow the worker to be reused
|
||||||
if (state != State.CREATED) throw new IllegalStateException();
|
if (state != State.CREATED) return;
|
||||||
state = State.CHECKING_FOR_DATA;
|
state = State.CHECKING_FOR_DATA;
|
||||||
}
|
}
|
||||||
ioExecutor.execute(this::checkForDataToSend);
|
ioExecutor.execute(this::checkForDataToSend);
|
||||||
|
|||||||
Reference in New Issue
Block a user