mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
crypto/tls: use method values
Currently fails with a compiler error, though. R=golang-dev, agl, rsc CC=golang-dev https://golang.org/cl/7933043
This commit is contained in:
parent
38e9b0773d
commit
76d5e2ce7d
2 changed files with 19 additions and 17 deletions
|
|
@ -204,7 +204,24 @@ type Config struct {
|
|||
// connections using that key are compromised.
|
||||
SessionTicketKey [32]byte
|
||||
|
||||
serverInitOnce sync.Once
|
||||
serverInitOnce sync.Once // guards calling (*Config).serverInit
|
||||
}
|
||||
|
||||
func (c *Config) serverInit() {
|
||||
if c.SessionTicketsDisabled {
|
||||
return
|
||||
}
|
||||
|
||||
// If the key has already been set then we have nothing to do.
|
||||
for _, b := range c.SessionTicketKey {
|
||||
if b != 0 {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := io.ReadFull(c.rand(), c.SessionTicketKey[:]); err != nil {
|
||||
c.SessionTicketsDisabled = true
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Config) rand() io.Reader {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue