Commit graph

181 commits

Author SHA1 Message Date
Simon Ser
089740758c worker/imap: use the IMAP connection from a single goroutine
Unfortunately, the IMAP protocol hasn't been designed to be used from multiple
goroutines at the same time. For instance, if you fetch twice the same message
from two different goroutines, it's not possible to tell whether the response
is for one receiver or the other. For this reason, go-imap clients aren't safe
to use from multiple goroutines.

This commit changes the IMAP workers to be synchronous again (a command is
executed only after the previous one has completed). To use IMAP from different
threads, popular clients (e.g. Thunderbird) typically open multiple
connections.
2019-04-29 09:49:22 -04:00
Simon Ser
9ef2a57b51 worker/types: fix Worker.Callbacks race condition
Worker.Process* functions were called in different goroutines than
Worker.Post*. Protect the map with a mutex. Also make the map unexported to
prevent external unprotected accesses.

Worker.Process* functions used to delete items from the map. However they
didn't delete the element they retrieved: callbacks[msg.InResponseTo()] was
read while callbacks[msg] was deleted. I'm not sure I understand why. I tried
to delete the element that was accessed - but this broke everything (UI froze
at "Connecting..."). I don't believe any elements were actually removed from
the map, so the new code just doesn't remove anything.
2019-04-27 14:28:26 -04:00
Drew DeVault
0abafa60e1 Make message viewer real, part two 2019-03-31 12:35:51 -04:00
Drew DeVault
95875b13f8 Rename FetchMessageBodies to FetchFullMessages 2019-03-31 12:19:30 -04:00
Drew DeVault
27b25174e2 Make the message viewer real, part one 2019-03-31 12:14:37 -04:00
Drew DeVault
143289bbd0 Don't parse mail in worker; send a reader instead 2019-03-31 11:29:57 -04:00
Drew DeVault
1f23868652 Pull BodyStructure up from IMAP worker 2019-03-31 11:10:10 -04:00
Drew DeVault
77ede6eb5a Add body fetching support code 2019-03-29 22:36:15 -04:00
Drew DeVault
312a53e5ff Implement :delete-message 2019-03-20 23:23:38 -04:00
Drew DeVault
de364846cc Display message subjects in message list 2019-03-14 22:19:04 -04:00
Drew DeVault
11f0a7267f Implement message store side of message fetching 2019-03-14 21:51:29 -04:00
Drew DeVault
b3896476a0 Fetch valid UIDs from server after opening dir 2019-03-10 23:45:00 -04:00
Drew DeVault
a782b709d1 Add loading spinner 2019-01-13 20:02:21 -05:00
Drew DeVault
4b350dddea Add name to DirectoryInfo messages 2019-01-13 19:37:06 -05:00
Drew DeVault
2750f99a60 Issue IMAP SELECT command 2019-01-13 16:18:10 -05:00
Drew DeVault
1265d9cff8 Apply gofmt 2018-06-12 09:50:46 -04:00
Markus Ongyerth
67d14977fa fallthrough in worker selection 2018-06-12 09:49:38 -04:00
Drew DeVault
25f21b55bd Tidy up list.go 2018-02-02 08:44:30 -05:00
Drew DeVault
d603bbe2ce Refactoring; consume listing response 2018-02-01 19:54:19 -05:00
Drew DeVault
cc03f6f4c8 Implement (most of) mailbox listing 2018-02-01 19:34:08 -05:00
Drew DeVault
1767e4fab5 Improve logging 2018-02-01 18:59:13 -05:00
Drew DeVault
d24e4712a4 Reduce boilerplate in worker/UI 2018-02-01 18:42:03 -05:00
Drew DeVault
3139148c7b Add certificate approval flow 2018-01-31 21:54:52 -05:00
Drew DeVault
a21afdaa6b Improve logging 2018-01-31 21:18:21 -05:00
emersion
1710c90548 Connect to IMAP server, login and idle 2018-01-14 10:26:38 -05:00
Drew DeVault
4074445cbb Move worker into account tab 2018-01-11 09:04:18 -05:00
Drew DeVault
db1b2cd53f Renderer scaffolding 2018-01-10 22:03:56 -05:00
emersion
a0be5e8025 Misc idiomatic fixes 2018-01-10 11:20:41 -05:00
Drew DeVault
305446abfd Sleep main and worker loops on idle 2018-01-10 08:37:09 -05:00
Drew DeVault
b5d5e0dbed Parse account configuration 2018-01-09 21:31:36 -05:00
Drew DeVault
6394e386c2 Initial pass on worker/UI message passing 2018-01-09 20:39:00 -05:00