Skip to content

Commit 3b882a7

Browse files
Merge pull request #13 from goinsane/develop
v1.2.6
2 parents 5104ddc + 30e9686 commit 3b882a7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@
2525
*.vscode
2626

2727
/vendor
28+
2829
/LOCALNOTES

accepter.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
7373
func (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.
102102
func (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.
148149
func (a *Accepter) Serve(lis net.Listener) (err error) {
149150
a.mu.Lock()

0 commit comments

Comments
 (0)