From 8a848303fe0f19fde02793024299356bcdb06048 Mon Sep 17 00:00:00 2001 From: Kevin Kuehler Date: Sun, 10 Nov 2019 14:17:55 -0800 Subject: 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 --- worker/imap/open.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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, -- cgit 1.4.1-2-gfad0 ut summary refs log tree commit diff stats
blob: 63679c9806199047641ce9d0be2fa5eb4326327c (plain) (blame)
1
2
3
4