-
Couldn't load subscription status.
- Fork 4.7k
Description
In function Server (tls.go) communication between client and target separated by directions.
In state when we want to pass all traffic between client and target there are two io.Copy(...) calls.
One for client -> target, and another for target -> client.
io.Copy(target, ...) dispatching client -> target stream may complete if client closes connection.
In this case nothing happen, and second io.Copy(underlying, ...) will keep untouched until target will close connection too (some servers may wait very long time before do it).
Probably it would be good to close target connection when client connection lost and io.Copy(target, ...) complete.
There is exactly same mechanism in target -> client direction,io.Copy(underlying, ...) call followed by underlying.CloseWrite().
It is simple to reproduce, just connect to xray with openssl s_client -connect ip:port and after successful connection just interrupt it with ctrl+c.
Graceful tls connection shutdown will not lead to this problem.