fix(proxy): not answering before client timeout

This is related to
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40230.

The initial MR that closed that issue,
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/391,
was not semantically correct, because `DataChannelTimeout`
starts after the client has already received the answer.

After
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/498#note_3156256
the code became not only semantically incorrect,
but also functionally incorrect because now if this timeout is hit
by the proxy, the client is guaranteed to be gone already.
This commit fixes it, by lowering the timeout.

This addresses a suggestion in
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40447.

This also closes
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40381
and supersedes
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/415.
This commit is contained in:
WofWca 2025-02-11 19:14:33 +04:00 committed by Cecylia Bocovich
parent cb30331aa2
commit cb0fb02cd5
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
3 changed files with 16 additions and 5 deletions

View file

@ -0,0 +1,10 @@
package constants
const (
// If the broker does not receive the proxy answer within this many seconds
// after the broker received the client offer,
// the broker will respond with an error to the client.
//
// this is calibrated to match the timeout of the CDNs we use for rendezvous
BrokerClientTimeout = 5
)