mirror of
https://github.com/XTLS/REALITY.git
synced 2026-09-25 00:08:01 +03:00
Close target when client closed
This commit is contained in:
@@ -272,7 +272,17 @@ func Server(ctx context.Context, conn net.Conn, config *Config) (*Conn, error) {
|
||||
if config.Show && hs.clientHello != nil {
|
||||
fmt.Printf("REALITY remoteAddr: %v\tforwarded SNI: %v\n", remoteAddr, hs.clientHello.serverName)
|
||||
}
|
||||
io.Copy(target, NewRatelimitedConn(underlying, &config.LimitFallbackUpload))
|
||||
_, err := io.Copy(target, NewRatelimitedConn(underlying, &config.LimitFallbackUpload))
|
||||
// close target writer when received FIN (err==nil)
|
||||
if err == nil {
|
||||
targetWriterCloser, ok := target.(CloseWriteConn)
|
||||
if ok {
|
||||
targetWriterCloser.CloseWrite()
|
||||
}
|
||||
} else {
|
||||
// Close target when encountering RST (or any other errors)
|
||||
target.Close()
|
||||
}
|
||||
}
|
||||
waitGroup.Done()
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user