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.
This commit is contained in:
Cecylia Bocovich 2020-11-05 12:34:24 -05:00
parent a4f10d9d6e
commit b5ce259858

View file

@ -137,16 +137,15 @@ func probeHandler(w http.ResponseWriter, r *http.Request) {
// Set a timeout on peerconnection. If the connection state has not // Set a timeout on peerconnection. If the connection state has not
// 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.
select { go func() {
case <-dataChan: select {
case <-dataChan:
case <-time.After(dataChannelTimeout):
}
if err := pc.Close(); err != nil { if err := pc.Close(); err != nil {
log.Printf("Error calling pc.Close: %v", err) log.Printf("Error calling pc.Close: %v", err)
} }
case <-time.After(dataChannelTimeout): }()
if err := pc.Close(); err != nil {
log.Printf("Error calling pc.Close: %v", err)
}
}
return return
} }