[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/master] Don't log io.ErrClosedPipe in proxy.
commit 912bcae24eb71bc52c6f28b908e3c7678781e1a2
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Thu Oct 22 23:01:45 2020 -0600
Don't log io.ErrClosedPipe in proxy.
We expect one of these at the end of just about every proxy session, as
the Conns in both directions are closed as soon as the copy loop
finishes in one direction.
Closes #40016.
---
proxy/snowflake.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/proxy/snowflake.go b/proxy/snowflake.go
index ac85527..96851ae 100644
--- a/proxy/snowflake.go
+++ b/proxy/snowflake.go
@@ -300,7 +300,9 @@ func CopyLoop(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser) {
var wg sync.WaitGroup
copyer := func(dst io.ReadWriteCloser, src io.ReadWriteCloser) {
defer wg.Done()
- if _, err := io.Copy(dst, src); err != nil {
+ // Ignore io.ErrClosedPipe because it is likely caused by the
+ // termination of copyer in the other direction.
+ if _, err := io.Copy(dst, src); err != nil && err != io.ErrClosedPipe {
log.Printf("io.Copy inside CopyLoop generated an error: %v", err)
}
dst.Close()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits