File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ import (
2323 "os"
2424 "strings"
2525 "sync"
26+ "time"
27+ )
28+
29+ const (
30+ // tlsHandshakeTimeout bounds how long a single TLS handshake may block.
31+ tlsHandshakeTimeout = 10 * time .Second
2632)
2733
2834// tlsListener overrides a TLS listener so it will reject client
@@ -143,6 +149,7 @@ func (l *tlsListener) acceptLoop() {
143149 }()
144150
145151 tlsConn := conn .(* tls.Conn )
152+ _ = tlsConn .SetDeadline (time .Now ().Add (tlsHandshakeTimeout ))
146153 herr := tlsConn .Handshake ()
147154 pendingMu .Lock ()
148155 delete (pending , conn )
@@ -152,6 +159,7 @@ func (l *tlsListener) acceptLoop() {
152159 l .handshakeFailure (tlsConn , herr )
153160 return
154161 }
162+ _ = tlsConn .SetDeadline (time.Time {})
155163 if err := l .check (ctx , tlsConn ); err != nil {
156164 l .handshakeFailure (tlsConn , err )
157165 return
You can’t perform that action at this time.
0 commit comments