aboutsummaryrefslogtreecommitdiff
path: root/worker/imap
diff options
context:
space:
mode:
authorKevin Kuehler <keur@xcf.berkeley.edu>2019-11-10 14:17:55 -0800
committerDrew DeVault <sir@cmpwn.com>2019-11-10 17:19:23 -0500
commit8a848303fe0f19fde02793024299356bcdb06048 (patch)
tree5c5da751ca1b06f237fb978e1f9b0acc7879c167 /worker/imap
parent08574104bc9ba550153888cfdc4ebf28d500ce56 (diff)
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>
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/open.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/worker/imap/open.go b/worker/imap/open.go
index 452c309..0602a7f 100644
--- a/worker/imap/open.go
+++ b/worker/imap/open.go
@@ -40,7 +40,9 @@ func (imapw *IMAPWorker) handleFetchDirectoryContents(
}, nil)
} else {
imapw.worker.Logger.Printf("Found %d UIDs", len(uids))
- imapw.seqMap = make([]uint32, len(uids))
+ if len(imapw.seqMap) < len(uids) {
+ imapw.seqMap = make([]uint32, len(uids))
+ }
imapw.worker.PostMessage(&types.DirectoryContents{
Message: types.RespondTo(msg),
Uids: uids,