Use net.ErrClosed
This commit is contained in:
parent
bc53657f5d
commit
bf12dd3871
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module git.sr.ht/~emersion/tlstunnel
|
||||
|
||||
go 1.15
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
git.sr.ht/~emersion/go-scfg v0.0.0-20211215104734-c2c7a15d6c99
|
||||
|
|
|
@ -3,6 +3,7 @@ package tlstunnel
|
|||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
|
@ -247,7 +248,7 @@ func (ln *Listener) UpdateFrom(new *Listener) *Listener {
|
|||
func (ln *Listener) serve() error {
|
||||
for {
|
||||
conn, err := ln.netLn.Accept()
|
||||
if err != nil && strings.Contains(err.Error(), "use of closed network connection") {
|
||||
if errors.Is(err, net.ErrClosed) {
|
||||
// Listening socket has been closed by Stop()
|
||||
return nil
|
||||
} else if err != nil {
|
||||
|
|
Loading…
Reference in New Issue