aboutsummaryrefslogtreecommitdiff
path: root/internal/imap
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-05-10 15:09:43 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-05-10 15:09:43 +0200
commitc9a3ba964784512b739699254b79be7aa9acc994 (patch)
treeda5ec7ffae3f0a4161af590107206d856844052e /internal/imap
parent7a661884ff633cd3d9215a285fdfd6dc98a6225d (diff)
downloadfeed2imap-go-c9a3ba964784512b739699254b79be7aa9acc994.tar.gz
feed2imap-go-c9a3ba964784512b739699254b79be7aa9acc994.tar.bz2
feed2imap-go-c9a3ba964784512b739699254b79be7aa9acc994.zip
#47: Exhaust messages to avoid deadlock
Diffstat (limited to 'internal/imap')
-rw-r--r--internal/imap/connection.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/imap/connection.go b/internal/imap/connection.go
index 213171e..3d537ea 100644
--- a/internal/imap/connection.go
+++ b/internal/imap/connection.go
@@ -170,7 +170,14 @@ func (conn *connection) fetchFlags(uid uint32) ([]string, error) {
done <- conn.c.UidFetch(seqSet, fetchItem, messages)
}()
- msg := <-messages
+ var msg *imap.Message
+ for m := range messages {
+ if msg == nil {
+ msg = m
+ } else {
+ panic(fmt.Sprintf("Duplicate message for uid %d. Found: %s(%d) and %s(%d)", uid, msg.Envelope.MessageId, msg.SeqNum, m.Envelope.MessageId, m.SeqNum))
+ }
+ }
err := <-done
if err != nil {