Ensure that the TLS handshake has been done before using tls.ConnectionState()
otherwise handshake is performed on first read/write and peer.TLS is invalid.
This commit is contained in:
parent
0857b2e4ed
commit
9fccea2351
1 changed files with 3 additions and 0 deletions
3
smtpd.go
3
smtpd.go
|
@ -119,6 +119,9 @@ func (srv *Server) newSession(c net.Conn) (s *session) {
|
|||
tlsConn, s.tls = c.(*tls.Conn)
|
||||
|
||||
if s.tls {
|
||||
// run handshake otherwise it's done when we first
|
||||
// read/write and connection state will be invalid
|
||||
tlsConn.Handshake()
|
||||
state := tlsConn.ConnectionState()
|
||||
s.peer.TLS = &state
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue