Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions reality.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,17 @@ func RealityServer(ctx context.Context, conn net.Conn, config *RealityConfig) (*
}
conn.Write(s2cSaved)
io.Copy(underlying, newRateLimitedConn(target, &config.LimitFallbackDownload))
// client ---underlying--- server ---target--- dest
// The dest has closed its side. Propagate that to the client with a
// half-close instead of leaving the connection open: the teardown
// below waits on the upload io.Copy, which only returns once the
// client closes, so a client that simply never closes keeps the
// connection alive long after the real dest would have dropped it.
// That difference is remotely observable and distinguishes this
// server from the dest it is imitating.
if cw, ok := underlying.(interface{ CloseWrite() error }); ok {
cw.CloseWrite()
}
}
waitGroup.Done()
}()
Expand Down