imap worker: do not copy mailbox status mutex

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
This commit is contained in:
Wagner Riffel 2019-08-22 09:53:27 -03:00 committed by Drew DeVault
parent ecd803aae4
commit 90453b5db4

View file

@ -42,7 +42,7 @@ type IMAPWorker struct {
client *imapClient client *imapClient
idleStop chan struct{} idleStop chan struct{}
idleDone chan error idleDone chan error
selected imap.MailboxStatus selected *imap.MailboxStatus
updates chan client.Update updates chan client.Update
worker *types.Worker worker *types.Worker
// Map of sequence numbers to UIDs, index 0 is seq number 1 // Map of sequence numbers to UIDs, index 0 is seq number 1
@ -54,6 +54,7 @@ func NewIMAPWorker(worker *types.Worker) (types.Backend, error) {
idleDone: make(chan error), idleDone: make(chan error),
updates: make(chan client.Update, 50), updates: make(chan client.Update, 50),
worker: worker, worker: worker,
selected: &imap.MailboxStatus{},
}, nil }, nil
} }
@ -196,7 +197,7 @@ func (w *IMAPWorker) handleImapUpdate(update client.Update) {
case *client.MailboxUpdate: case *client.MailboxUpdate:
status := update.Mailbox status := update.Mailbox
if w.selected.Name == status.Name { if w.selected.Name == status.Name {
w.selected = *status w.selected = status
} }
w.worker.PostMessage(&types.DirectoryInfo{ w.worker.PostMessage(&types.DirectoryInfo{
Info: &models.DirectoryInfo{ Info: &models.DirectoryInfo{