mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
fix(proxy): improve NAT test reliability
This is a hack, and I'm not entirely sure how it works, but it appears to work, at least somewhat. See https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40419#note_3141855.
This commit is contained in:
parent
e345c3bac9
commit
6384643109
1 changed files with 13 additions and 1 deletions
|
@ -592,7 +592,19 @@ func (sf *SnowflakeProxy) makeNewPeerConnection(
|
|||
})
|
||||
dc.OnClose(func() {
|
||||
log.Println("WebRTC: DataChannel.OnClose")
|
||||
dc.Close()
|
||||
go func() {
|
||||
// A hack to make NAT testing more reliable and not mis-identify
|
||||
// as "restricted".
|
||||
// See https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40419#note_3141855.
|
||||
// Instead we should just `dc.Close()` without waiting
|
||||
// and without a goroutine.
|
||||
// (or, perhaps, `dc.Close()` is not needed at all
|
||||
// in the OnClose callback?)
|
||||
<-time.After(5 * time.Second)
|
||||
|
||||
log.Print("NAT check: WebRTC: dc.Close()")
|
||||
dc.Close()
|
||||
}()
|
||||
})
|
||||
|
||||
offer, err := pc.CreateOffer(nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue