[tor-commits] [snowflake/master] Moved data channel timeout to constant

cohosh at torproject.org cohosh at torproject.org
Thu Apr 11 13:58:59 UTC 2019


commit 62fddab153019ac7e5d7efd1d327b20aede921c3
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Fri Apr 5 10:40:11 2019 -0400

    Moved data channel timeout to constant
---
 proxy-go/snowflake.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/proxy-go/snowflake.go b/proxy-go/snowflake.go
index 1c24e47..50c20a5 100644
--- a/proxy-go/snowflake.go
+++ b/proxy-go/snowflake.go
@@ -26,6 +26,9 @@ const defaultBrokerURL = "https://snowflake-broker.bamsoftware.com/"
 const defaultRelayURL = "wss://snowflake.bamsoftware.com/"
 const defaultSTUNURL = "stun:stun.l.google.com:19302"
 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 relayURL string
@@ -330,7 +333,7 @@ func makePeerConnectionFromOffer(sdp *webrtc.SessionDescription, config *webrtc.
 	// advanced to PeerConnectionStateConnected in this time,
 	// destroy the peer connection and return the token.
 	go func() {
-		<-time.After(time.Minute)
+		<-time.After(dataChannelTimeout)
 		if pc.ConnectionState() != webrtc.PeerConnectionStateConnected {
 			log.Println("Timed out waiting for client to open data cannel.")
 			pc.Destroy()





More information about the tor-commits mailing list