crypto/tls: make Listener a pointer.

Listener contains private members and 6g now enforces that private
members cannot be assigned outside of their package.

R=rsc
CC=golang-dev
https://golang.org/cl/183073
This commit is contained in:
Adam Langley 2009-12-28 11:40:01 -08:00
parent 581072a866
commit 016dd4b5cb

9
tls.go
View File

@ -162,7 +162,7 @@ type Listener struct {
config *Config config *Config
} }
func (l Listener) Accept() (c net.Conn, err os.Error) { func (l *Listener) Accept() (c net.Conn, err os.Error) {
c, err = l.listener.Accept() c, err = l.listener.Accept()
if err != nil { if err != nil {
return return
@ -172,13 +172,14 @@ func (l Listener) Accept() (c net.Conn, err os.Error) {
return return
} }
func (l Listener) Close() os.Error { return l.listener.Close() } func (l *Listener) Close() os.Error { return l.listener.Close() }
func (l Listener) Addr() net.Addr { return l.listener.Addr() } func (l *Listener) Addr() net.Addr { return l.listener.Addr() }
// NewListener creates a Listener which accepts connections from an inner // NewListener creates a Listener which accepts connections from an inner
// Listener and wraps each connection with Server. // Listener and wraps each connection with Server.
func NewListener(listener net.Listener, config *Config) (l Listener) { func NewListener(listener net.Listener, config *Config) (l *Listener) {
l = new(Listener)
l.listener = listener l.listener = listener
l.config = config l.config = config
return return