Move mail content processing within the logical lock.
This commit is contained in:
@@ -3116,17 +3116,18 @@ StoreCommandWRITE(StoreClient *client,
|
||||
if (filename) strncpy(newdocument.filename, filename, MAX_FILE_NAME);
|
||||
|
||||
StoreObjectFixUpFilename(collection, &newdocument);
|
||||
StoreObjectUpdateImapUID(client, &newdocument);
|
||||
if (no_process == 0) {
|
||||
// update metadata if we haven't been asked not to
|
||||
StoreProcessDocument(client, &newdocument, tmppath);
|
||||
}
|
||||
|
||||
if (! LogicalLockGain(client, collection, LLOCK_READWRITE)) {
|
||||
unlink(tmppath);
|
||||
return ConnWriteStr(client->conn, MSG4120BOXLOCKED);
|
||||
}
|
||||
|
||||
StoreObjectUpdateImapUID(client, &newdocument);
|
||||
if (no_process == 0) {
|
||||
// update metadata if we haven't been asked not to
|
||||
StoreProcessDocument(client, &newdocument, tmppath);
|
||||
}
|
||||
|
||||
// put content in place
|
||||
FindPathToDocument(client, collection->guid, newdocument.guid, path, sizeof(path));
|
||||
link(tmppath, path);
|
||||
|
||||
@@ -316,14 +316,15 @@ DeliverMessageToMailbox(StoreClient *client,
|
||||
newmail.flags = flags;
|
||||
newmail.time_created = newmail.time_modified = (uint64_t) time(NULL);
|
||||
|
||||
StoreProcessDocument(client, &newmail, tmppath);
|
||||
|
||||
// need to acquire lock from this point
|
||||
if (! LogicalLockGain(client, &collection, LLOCK_READWRITE)) {
|
||||
StoreObjectRemove(client, &newmail);
|
||||
goto ioerror;
|
||||
}
|
||||
|
||||
// possibly need more locking involved in this function
|
||||
StoreProcessDocument(client, &newmail, tmppath);
|
||||
|
||||
// now we have guid etc., move the mail into the right place
|
||||
if (MaildirDeliverTempDocument(client, collection.guid, tmppath, newmail.guid)) {
|
||||
printf("Can't put temporary mail into the store\n");
|
||||
|
||||
Reference in New Issue
Block a user