[tor-commits] [snowflake/master] Fixed a bug that forced datachannel timeout

cohosh at torproject.org cohosh at torproject.org
Thu Nov 5 21:49:44 UTC 2020


commit b5ce2598586d729b0906d3936706dc48e82e1455
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Thu Nov 5 12:34:24 2020 -0500

    Fixed a bug that forced datachannel timeout
    
    The probetest answer response was not being sent until the select call
    received a datachannel timeout causing all attempted connections to
    fail.
---
 probetest/probetest.go | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/probetest/probetest.go b/probetest/probetest.go
index af08e32..1d2d6ef 100644
--- a/probetest/probetest.go
+++ b/probetest/probetest.go
@@ -137,16 +137,15 @@ func probeHandler(w http.ResponseWriter, r *http.Request) {
 	// Set a timeout on peerconnection. If the connection state has not
 	// advanced to PeerConnectionStateConnected in this time,
 	// destroy the peer connection and return the token.
-	select {
-	case <-dataChan:
-		if err := pc.Close(); err != nil {
-			log.Printf("Error calling pc.Close: %v", err)
+	go func() {
+		select {
+		case <-dataChan:
+		case <-time.After(dataChannelTimeout):
 		}
-	case <-time.After(dataChannelTimeout):
 		if err := pc.Close(); err != nil {
 			log.Printf("Error calling pc.Close: %v", err)
 		}
-	}
+	}()
 	return
 
 }





More information about the tor-commits mailing list