emersion / go-imap

📥 An IMAP library for clients and servers
MIT License
2.1k stars 296 forks source link

[v2] fetchCmd.Close() never finish if timeout #650

Open wms15391 opened 1 week ago

wms15391 commented 1 week ago

change literalReadTimeout = 2 * time.Second to test,and read a message with attachments ......

fetchOptions := &imap.FetchOptions{BodySection: []*imap.FetchItemBodySection{{}}}
fetchCmd := c.Fetch(seqSet, fetchOptions)
defer fetchCmd.Close()
......
b, err := io.ReadAll(p.Body)
if err != nil {
    log(err) //got log: read tcp 192.168.10.21:62984->xxx.xxx.xxx.xxx:993: i/o timeout
    return  err //no return,unless delete "defer fetchCmd.Close()"
}