author | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-10-08 11:16:27 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-10-09 23:51:05 UTC |
parent | dbe3843e12145ca28424caa390c394b1bd594478 |
chasquid.go | +5 | -1 |
internal/courier/smtp.go | +1 | -0 |
diff --git a/chasquid.go b/chasquid.go index 1ed8087..ae5b261 100644 --- a/chasquid.go +++ b/chasquid.go @@ -445,8 +445,12 @@ type Conn struct { commandTimeout time.Duration } +func (c *Conn) Close() { + c.netconn.Close() +} + func (c *Conn) Handle() { - defer c.netconn.Close() + defer c.Close() c.tr = trace.New("SMTP.Conn", c.netconn.RemoteAddr().String()) defer c.tr.Finish() diff --git a/internal/courier/smtp.go b/internal/courier/smtp.go index 71fcb11..6e3b916 100644 --- a/internal/courier/smtp.go +++ b/internal/courier/smtp.go @@ -57,6 +57,7 @@ retry: if err != nil { return tr.Errorf("Could not dial: %v", err), false } + defer conn.Close() conn.SetDeadline(time.Now().Add(smtpTotalTimeout)) c, err := smtp.NewClient(conn, mx)