@@ -71,7 +71,7 @@ func (a *Accepter) cancel() error {
7171// immediately return nil. Make sure the program doesn't exit and waits
7272// instead for Shutdown to return.
7373func (a * Accepter ) Shutdown (ctx context.Context ) (err error ) {
74- a .cancel ()
74+ err = a .cancel ()
7575
7676 for {
7777 select {
@@ -100,7 +100,7 @@ func (a *Accepter) Shutdown(ctx context.Context) (err error) {
100100// Close returns any error returned from closing the Accepter's underlying
101101// Listener.
102102func (a * Accepter ) Close () (err error ) {
103- a .cancel ()
103+ err = a .cancel ()
104104
105105 a .connsMu .RLock ()
106106 for conn := range a .conns {
@@ -124,7 +124,7 @@ func (a *Accepter) ListenAndServe(network, address string) error {
124124}
125125
126126// ListenAndServeTLS listens on the given network and address; and
127- // then calls Serve to handle incoming TLS connections.
127+ // then calls ServeTLS to handle incoming TLS connections.
128128//
129129// Filenames containing a certificate and matching private key for the
130130// Accepter must be provided if neither the Accepter's TLSConfig.Certificates
@@ -143,7 +143,8 @@ func (a *Accepter) ListenAndServeTLS(network, address string, certFile, keyFile
143143
144144// Serve accepts incoming connections on the Listener lis, creating a new service
145145// goroutine for each. The service goroutines read requests and then call
146- // a.Handler to reply to them. Serve returns a nil error after Close or
146+ // a.Handler to reply to them. Serve always closes lis if returned error
147+ // is not ErrAlreadyServed. Serve returns a nil error after Close or
147148// Shutdown method called.
148149func (a * Accepter ) Serve (lis net.Listener ) (err error ) {
149150 a .mu .Lock ()
0 commit comments