mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +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");
|
||||
synchronized (lock) {
|
||||
// Don't allow the worker to be reused
|
||||
if (state != State.CREATED) throw new IllegalStateException();
|
||||
if (state != State.CREATED) return;
|
||||
state = State.CONNECTIVITY_CHECK;
|
||||
}
|
||||
// Avoid leaking observer in case destroy() is called concurrently
|
||||
|
||||
@@ -147,7 +147,7 @@ class MailboxUploadWorker implements MailboxWorker, ConnectivityObserver,
|
||||
LOG.info("Started");
|
||||
synchronized (lock) {
|
||||
// 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;
|
||||
}
|
||||
ioExecutor.execute(this::checkForDataToSend);
|
||||
|
||||
Reference in New Issue
Block a user