mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-06 12:54:11 +01:00
Prevent send/cancel race condition
This commit is contained in:
@@ -482,6 +482,10 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
|
||||
private void onSend(EntityMessage message) throws MessagingException, IOException {
|
||||
DB db = DB.getInstance(this);
|
||||
|
||||
EntityOperation operation = db.operation().getOperation(message.id, EntityOperation.SEND);
|
||||
if (operation == null)
|
||||
throw new IllegalArgumentException("Send cancelled");
|
||||
|
||||
// Mark attempt
|
||||
if (message.last_attempt == null) {
|
||||
message.last_attempt = new Date().getTime();
|
||||
|
||||
Reference in New Issue
Block a user