about summary refs log tree commit diff stats
path: root/worker
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
parent08574104bc9ba550153888cfdc4ebf28d500ce56 (diff)
downloadaerc-8a848303fe0f19fde02793024299356bcdb06048.tar.gz
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')
-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,
div class='alt'>
a0be5e8 ^

39c93d2 ^

60b351b ^
cab3771 ^
77a0f68 ^


1418e1b ^
60b351b ^
1418e1b ^

661e3ec ^

305446a ^
6394e38 ^
aeb7005
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45