Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions client/pkg/transport/listener_tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ import (
"net"
"strings"
"sync"
"time"
)

const (
// tlsHandshakeTimeout bounds how long a single TLS handshake may block.
tlsHandshakeTimeout = 10 * time.Second
)

// tlsListener overrides a TLS listener so it will reject client
Expand Down Expand Up @@ -143,6 +149,7 @@ func (l *tlsListener) acceptLoop() {
}()

tlsConn := conn.(*tls.Conn)
_ = tlsConn.SetDeadline(time.Now().Add(tlsHandshakeTimeout))
herr := tlsConn.Handshake()
pendingMu.Lock()
delete(pending, conn)
Expand All @@ -152,6 +159,7 @@ func (l *tlsListener) acceptLoop() {
l.handshakeFailure(tlsConn, herr)
return
}
_ = tlsConn.SetDeadline(time.Time{})
if err := l.check(ctx, tlsConn); err != nil {
l.handshakeFailure(tlsConn, err)
return
Expand Down