aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCecylia Bocovich <cohosh@torproject.org>2020-11-05 12:34:24 -0500
committerCecylia Bocovich <cohosh@torproject.org>2020-11-05 16:46:48 -0500
commitb5ce2598586d729b0906d3936706dc48e82e1455 (patch)
treefaebd57ad04fa4e2f2cc569a9783f4e5b04a5657
parenta4f10d9d6eaa8806adc5eefaf7ac46d4050340d1 (diff)
downloadsnowflake-b5ce2598586d729b0906d3936706dc48e82e1455.tar.gz
snowflake-b5ce2598586d729b0906d3936706dc48e82e1455.zip
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.
-rw-r--r--probetest/probetest.go11
1 files 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
}