diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-05-10 15:09:43 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-05-10 15:09:43 +0200 |
commit | c9a3ba964784512b739699254b79be7aa9acc994 (patch) | |
tree | da5ec7ffae3f0a4161af590107206d856844052e | |
parent | 7a661884ff633cd3d9215a285fdfd6dc98a6225d (diff) | |
download | feed2imap-go-c9a3ba964784512b739699254b79be7aa9acc994.tar.gz feed2imap-go-c9a3ba964784512b739699254b79be7aa9acc994.tar.bz2 feed2imap-go-c9a3ba964784512b739699254b79be7aa9acc994.zip |
#47: Exhaust messages to avoid deadlock
Diffstat (limited to '')
-rw-r--r-- | internal/imap/connection.go | 9 |
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 { |