mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 14:11:23 -04:00
Moved data channel timeout to constant
This commit is contained in:
parent
08f5205461
commit
62fddab153
1 changed files with 4 additions and 1 deletions
|
@ -26,6 +26,9 @@ const defaultBrokerURL = "https://snowflake-broker.bamsoftware.com/"
|
||||||
const defaultRelayURL = "wss://snowflake.bamsoftware.com/"
|
const defaultRelayURL = "wss://snowflake.bamsoftware.com/"
|
||||||
const defaultSTUNURL = "stun:stun.l.google.com:19302"
|
const defaultSTUNURL = "stun:stun.l.google.com:19302"
|
||||||
const pollInterval = 5 * time.Second
|
const pollInterval = 5 * time.Second
|
||||||
|
//amount of time after sending an SDP answer before the proxy assumes the
|
||||||
|
//client is not going to connect
|
||||||
|
const dataChannelTimeout = time.Minute
|
||||||
|
|
||||||
var brokerURL *url.URL
|
var brokerURL *url.URL
|
||||||
var relayURL string
|
var relayURL string
|
||||||
|
@ -330,7 +333,7 @@ func makePeerConnectionFromOffer(sdp *webrtc.SessionDescription, config *webrtc.
|
||||||
// advanced to PeerConnectionStateConnected in this time,
|
// advanced to PeerConnectionStateConnected in this time,
|
||||||
// destroy the peer connection and return the token.
|
// destroy the peer connection and return the token.
|
||||||
go func() {
|
go func() {
|
||||||
<-time.After(time.Minute)
|
<-time.After(dataChannelTimeout)
|
||||||
if pc.ConnectionState() != webrtc.PeerConnectionStateConnected {
|
if pc.ConnectionState() != webrtc.PeerConnectionStateConnected {
|
||||||
log.Println("Timed out waiting for client to open data cannel.")
|
log.Println("Timed out waiting for client to open data cannel.")
|
||||||
pc.Destroy()
|
pc.Destroy()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue