mirror of
https://github.com/rancher/dynamiclistener.git
synced 2025-06-24 13:51:34 +00:00
Fix net.Conn type assertion
Don't assert that all connections are wrapped, as they won't be if the CloseConnOnCertChange setting is false. Only run the assertion within a conditional for wrapped connections, where it is safe. This prevents a panic from happening when CloseConnOnCertChange is not used.
This commit is contained in:
parent
6b37dc1212
commit
fb66484384
@ -299,7 +299,7 @@ func (l *listener) getCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate,
|
||||
}
|
||||
}
|
||||
|
||||
return l.loadCert(newConn.(*closeWrapper))
|
||||
return l.loadCert(newConn)
|
||||
}
|
||||
|
||||
func (l *listener) updateCert(cn ...string) error {
|
||||
@ -341,7 +341,7 @@ func (l *listener) updateCert(cn ...string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *listener) loadCert(currentConn *closeWrapper) (*tls.Certificate, error) {
|
||||
func (l *listener) loadCert(currentConn net.Conn) (*tls.Certificate, error) {
|
||||
l.RLock()
|
||||
defer l.RUnlock()
|
||||
|
||||
@ -381,7 +381,7 @@ func (l *listener) loadCert(currentConn *closeWrapper) (*tls.Certificate, error)
|
||||
}
|
||||
_ = conn.close()
|
||||
}
|
||||
l.conns[currentConn.id].ready = true
|
||||
l.conns[currentConn.(*closeWrapper).id].ready = true
|
||||
l.connLock.Unlock()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user