aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-21 16:43:39 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-21 17:43:31 +0100
commit1f03f19402266c63bbb7120f50caacf3f6f79a36 (patch)
treedbdfb686393d7d9a924afca77433c507bf311e83 /internal
parent3e9a26af773f5025e1540f9be5da952c448f1edd (diff)
downloadfeed2imap-go-1f03f19402266c63bbb7120f50caacf3f6f79a36.tar.gz
feed2imap-go-1f03f19402266c63bbb7120f50caacf3f6f79a36.tar.bz2
feed2imap-go-1f03f19402266c63bbb7120f50caacf3f6f79a36.zip
#25 Check for folder again while locking
Diffstat (limited to 'internal')
-rw-r--r--internal/imap/mailboxes.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/imap/mailboxes.go b/internal/imap/mailboxes.go
index f1dc6c6..25bf087 100644
--- a/internal/imap/mailboxes.go
+++ b/internal/imap/mailboxes.go
@@ -26,6 +26,14 @@ func (mbs *mailboxes) unlocking(elem Folder) {
func (mbs *mailboxes) locking(elem Folder) bool {
mbs.mu.Lock()
+
+ // check again, if the folder has been created in the meantime
+ _, ok := mbs.mb[elem.str]
+ if ok {
+ mbs.mu.Unlock()
+ return true
+ }
+
ch, ok := mbs.changeLocks[elem.str]
if !ok {
ch = make(chan struct{})