Skip to content

Commit

Permalink
Fix conn leak in Quit(). Closes #13.
Browse files Browse the repository at this point in the history
Co-authored-by: TestMsr <cs3120@vip.qq.com>
  • Loading branch information
knadh and TestMsr committed Feb 27, 2024
1 parent 620e5d6 commit 741df52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pop3.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,13 @@ func (c *Conn) Noop() error {
// Message deletions (DELE command) are only excuted by the server on a graceful
// quit and close.
func (c *Conn) Quit() error {
defer c.conn.Close()

if _, err := c.Cmd("QUIT", false); err != nil {
return err
}
return c.conn.Close()

return nil
}

// parseResp checks if the response is an error that starts with `-ERR`
Expand Down

0 comments on commit 741df52

Please # to comment.