worker/imap: Fix seqMap race condition
When deleting a message, sometimes FetchDirectoryContents will fire. FetchDirectoryContents will return a smaller set of UIDs since messages have been deleted. This operation races with fetching from the seqMap in client.ExpungeUpdate. Only recreate the seqMap if it can grow so that messages will continue to be expunged. Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
This commit is contained in:
parent
08574104bc
commit
8a848303fe
|
@ -40,7 +40,9 @@ func (imapw *IMAPWorker) handleFetchDirectoryContents(
|
||||||
}, nil)
|
}, nil)
|
||||||
} else {
|
} else {
|
||||||
imapw.worker.Logger.Printf("Found %d UIDs", len(uids))
|
imapw.worker.Logger.Printf("Found %d UIDs", len(uids))
|
||||||
|
if len(imapw.seqMap) < len(uids) {
|
||||||
imapw.seqMap = make([]uint32, len(uids))
|
imapw.seqMap = make([]uint32, len(uids))
|
||||||
|
}
|
||||||
imapw.worker.PostMessage(&types.DirectoryContents{
|
imapw.worker.PostMessage(&types.DirectoryContents{
|
||||||
Message: types.RespondTo(msg),
|
Message: types.RespondTo(msg),
|
||||||
Uids: uids,
|
Uids: uids,
|
||||||
|
|
Loading…
Reference in New Issue