mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 09:37:02 +00:00
pop3 TLS: don't do server-side handshake explicitly... (#386)
This commit is contained in:
@@ -2,7 +2,6 @@ package pop3
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -110,14 +109,6 @@ func (s *Server) startSession(id int, conn net.Conn) {
|
||||
if s.config.ForceTLS {
|
||||
logger.Debug().Msg("Setting up TLS for ForceTLS")
|
||||
tlsConn := tls.Server(conn, s.tlsConfig)
|
||||
toCtx, toCtxCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer toCtxCancel()
|
||||
if err := tlsConn.HandshakeContext(toCtx); err != nil {
|
||||
logger.Error().Msgf("TLS handshake failed: %v.", err)
|
||||
conn.Close()
|
||||
s.wg.Done()
|
||||
return
|
||||
}
|
||||
s.tlsState = new(tls.ConnectionState)
|
||||
*s.tlsState = tlsConn.ConnectionState()
|
||||
conn = tlsConn
|
||||
|
||||
Reference in New Issue
Block a user