mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
fix(proxy): send answer even if ICE gathering is not complete
Otherwise the connection is guaranteed to fail, even though we actually might have gathered enough to make a successful connection. Closes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40230 This is the standalone proxy counterpart of https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake-webext/-/merge_requests/55
This commit is contained in:
parent
2bbd4d0643
commit
7f9fea5797
1 changed files with 11 additions and 2 deletions
|
@ -50,6 +50,8 @@ import (
|
|||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/task"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/util"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/websocketconn"
|
||||
|
||||
snowflakeClient "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/client/lib"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -529,8 +531,15 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Wait for ICE candidate gathering to complete
|
||||
<-done
|
||||
// Wait for ICE candidate gathering to complete,
|
||||
// or for whatever we managed to gather before the client times out.
|
||||
// See https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40230
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(snowflakeClient.DataChannelTimeout / 2):
|
||||
log.Print("ICE gathering is not yet complete, but let's send the answer" +
|
||||
" before the client times out")
|
||||
}
|
||||
|
||||
if !strings.Contains(pc.LocalDescription().SDP, "\na=candidate:") {
|
||||
return nil, fmt.Errorf("SDP answer contains no candidate")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue