Skip to content
Snippets Groups Projects
Commit 6af2a87d authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Expire connections after 5s trying to connect

parent 1b063bb0
No related branches found
No related tags found
No related merge requests found
......@@ -149,6 +149,8 @@ class WebRTCClass
@transport.onRemoteDescription @onRemoteDescription.bind @
@transport.onRemoteStatus @onRemoteStatus.bind @
Meteor.setInterval @checkPeerConnections.bind(@), 1000
Meteor.setInterval @broadcastStatus.bind(@), 1000
log: ->
......@@ -158,6 +160,11 @@ class WebRTCClass
onError: ->
console.error.apply(console, arguments)
checkPeerConnections: ->
for id, peerConnection of @peerConnections
if peerConnection.iceConnectionState not in ['connected', 'completed'] and peerConnection.createdAt + 5000 < Date.now()
@stopPeerConnection id
updateRemoteItems: ->
items = []
itemsById = {}
......@@ -243,6 +250,7 @@ class WebRTCClass
peerConnection = new RTCPeerConnection @config
peerConnection.createdAt = Date.now()
peerConnection.remoteMedia = {}
@peerConnections[id] = peerConnection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment