Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stability] fix socket closing when peer leaves #556

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

schlagmichdoch
Copy link
Contributor

@schlagmichdoch schlagmichdoch commented Jan 6, 2023

Error

Often the following error is logged:

Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Failed to set local answer sdp: Called in wrong state: stable

(See: #555 #542 #532 #345 #258 #252 #249 #247 #233 #194 #24)

Cause

I discovered that sockets are not properly closed when a peer leaves and quickly rejoines

Fix

This PR fixes the closing of sockets:

  • In the method _onPeerLeft(peerId): The property peer._peer must be peer._conn.
  • Do not reopen the channel after closing by setting peer._channel.onclose = null

Additionally this PR closes all p2p connections when the websocket connection is closed.

Stability

Together with #528, #537 and #531 this increases the stabilty a lot on my instance

dxlliv added a commit to dxlliv/snapshare that referenced this pull request May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant