Skip to content

Commit

Permalink
Skip io.EOF error
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Jul 6, 2022
1 parent fb3a6e0 commit 77fba1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ func (c *Conn) handleStartTLS() {
tlsConn := tls.Server(c.conn, c.server.TLSConfig)

if err := tlsConn.Handshake(); err != nil {
if err == io.EOF {
return
}
c.server.ErrorLog.Printf("TLS handshake error for %s: %v", c.conn.RemoteAddr(), err)
c.WriteResponse(550, EnhancedCode{5, 0, 0}, "Handshake error")
return
Expand Down
3 changes: 3 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ func (s *Server) handleConn(c *Conn) error {
c.conn.SetWriteDeadline(time.Now().Add(d))
}
if err := tlsConn.Handshake(); err != nil {
if err == io.EOF {
return nil
}
s.ErrorLog.Printf("TLS handshake error for %s: %v", tlsConn.RemoteAddr(), err)
return err
}
Expand Down

0 comments on commit 77fba1e

Please sign in to comment.