author | Alberto Bertogli
<albertito@blitiri.com.ar> 2019-03-31 11:13:09 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2019-03-31 11:13:09 UTC |
parent | ec95131bb4963b0bb7230868202fceda2588d4e4 |
internal/smtpsrv/conn.go | +4 | -0 |
diff --git a/internal/smtpsrv/conn.go b/internal/smtpsrv/conn.go index 479fb59..d3fe30a 100644 --- a/internal/smtpsrv/conn.go +++ b/internal/smtpsrv/conn.go @@ -163,6 +163,10 @@ func (c *Conn) Handle() { defer c.tr.Finish() c.tr.Debugf("Connected, mode: %s", c.mode) + // Set the first deadline, which covers possibly the TLS handshake and + // then our initial greeting. + c.conn.SetDeadline(time.Now().Add(c.commandTimeout)) + if tc, ok := c.conn.(*tls.Conn); ok { // For TLS connections, complete the handshake and get the state, so // it can be used when we say hello below.