1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:04:40 -07:00

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 5f132b93eb
commit 3c6bf09539

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