From 6d409d0f001bb11f832478449bf012ce51543983 Mon Sep 17 00:00:00 2001 From: liqiang <974923609@qq.com> Date: Wed, 24 Mar 2021 16:31:39 +0800 Subject: [PATCH] chore: CloseWrite --- proxy/helper.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/proxy/helper.go b/proxy/helper.go index f659bec..4b97624 100644 --- a/proxy/helper.go +++ b/proxy/helper.go @@ -3,6 +3,7 @@ package proxy import ( "bytes" "io" + "net" "os" "strings" "sync" @@ -54,7 +55,12 @@ func Transfer(log *_log.Entry, a, b io.ReadWriteCloser) { } } - err = dst.Close() + if dstc, ok := dst.(*net.TCPConn); ok { + err = dstc.CloseWrite() + } else { + err = dst.Close() + } + select { case <-done: return