Suppress connection end log output

This is an amendment of https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/30
This commit is contained in:
Shelikhoo 2022-01-06 20:31:15 +00:00 committed by Cecylia Bocovich
parent b35a79ac24
commit 50646698e3
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
2 changed files with 5 additions and 3 deletions

View file

@ -38,6 +38,7 @@ package snowflake_server
import (
"crypto/tls"
"errors"
"fmt"
"io"
"log"
@ -262,7 +263,7 @@ func (l *SnowflakeListener) acceptSessions(ln *kcp.Listener) error {
go func() {
defer conn.Close()
err := l.acceptStreams(conn)
if err != nil && err != io.ErrClosedPipe {
if err != nil && !errors.Is(err, io.ErrClosedPipe) {
log.Printf("acceptStreams: %v", err)
}
}()