mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -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() {
|
dc.OnClose(func() {
|
||||||
log.Println("WebRTC: DataChannel.OnClose")
|
log.Println("WebRTC: DataChannel.OnClose")
|
||||||
|
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()
|
dc.Close()
|
||||||
|
}()
|
||||||
})
|
})
|
||||||
|
|
||||||
offer, err := pc.CreateOffer(nil)
|
offer, err := pc.CreateOffer(nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue