diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-01-13 06:03:24 +0300 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2022-01-13 06:40:34 +0300 |
commit | cf0cf8df3f44d9d279809afe14282fe360823b07 (patch) | |
tree | d90392f0d1828960458669dd3642d0fc5bbb029b /src/utils/webrtc | |
parent | 6efbeda433377606e9571bc9744aba9efb3a2e9a (diff) |
Stop sending offers again for own peer if current session ID changed
When an own peer is needed offers are periodically sent until the
connection is established. However, if the current session ID changed
(which would happen after a forced reconnection) the previous session
ID is no longer relevant, so the offers with the old ID should not be
sent anymore (the process to send offers with the new ID will be started
when needed).
Moreover, the previous process must be stopped as well to prevent
creating new Peer objects with the old ID, which would cause them to be
added to the CallParticipantCollection (as the ID does not match with
the current session ID, so it is seen as a peer for another participant)
and thus appear in the call view.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src/utils/webrtc')
-rw-r--r-- | src/utils/webrtc/webrtc.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils/webrtc/webrtc.js b/src/utils/webrtc/webrtc.js index 4820ec176..275dccc52 100644 --- a/src/utils/webrtc/webrtc.js +++ b/src/utils/webrtc/webrtc.js @@ -190,6 +190,15 @@ function checkStartPublishOwnPeer(signaling) { ownPeer.end() } + if (currentSessionId !== signaling.getSessionId()) { + console.debug('No answer received for own peer but current session id changed, not sending offer again') + + clearInterval(delayedConnectionToPeer[currentSessionId]) + delete delayedConnectionToPeer[currentSessionId] + + return + } + console.debug('No answer received for own peer, sending offer again') createPeer() }, 10000) |