From c2277c4917c53cd6150fa9b8c5d16c9c4d644fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Tue, 29 Jun 2021 22:41:30 +0200 Subject: [PATCH] webrtc: remove offer timeout as this is handled by lib. --- internal/webrtc/peer.go | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/internal/webrtc/peer.go b/internal/webrtc/peer.go index 95a0b9f6..ea51ec40 100644 --- a/internal/webrtc/peer.go +++ b/internal/webrtc/peer.go @@ -1,14 +1,6 @@ package webrtc -import ( - "time" - - "github.com/pion/webrtc/v3" - "github.com/rs/zerolog/log" -) - -// how long is can take between sending offer and connecting -const offerTimeout = 10 * time.Second +import "github.com/pion/webrtc/v3" type WebRTCPeerCtx struct { api *webrtc.API @@ -19,22 +11,6 @@ type WebRTCPeerCtx struct { } func (peer *WebRTCPeerCtx) CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error) { - // offer timeout - go func() { - time.Sleep(offerTimeout) - - // already disconnected - if peer.connection.ConnectionState() == webrtc.PeerConnectionStateClosed { - return - } - - // not connected - if peer.connection.ConnectionState() != webrtc.PeerConnectionStateConnected { - log.Warn().Msg("connection timeouted, closing") - peer.connection.Close() - } - }() - offer, err := peer.connection.CreateOffer(&webrtc.OfferOptions{ ICERestart: ICERestart, })