1
1
Fork 0
mirror of https://git.sr.ht/~emersion/tlstunnel synced 2024-04-28 00:35:05 +02:00

Use net.ErrClosed

This commit is contained in:
Simon Ser 2022-07-07 10:55:25 +02:00
parent bc53657f5d
commit bf12dd3871
2 changed files with 3 additions and 2 deletions

2
go.mod
View File

@ -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

View File

@ -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 {