~sircmpwn/aerc

8a848303fe0f19fde02793024299356bcdb06048 — Kevin Kuehler 1 year, 2 months ago 0857410
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>
1 files changed, 3 insertions(+), 1 deletions(-)

M worker/imap/open.go
M worker/imap/open.go => worker/imap/open.go +3 -1
@@ 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,