Skip to content

[stability] fix socket closing when peer leaves#556

Open
schlagmichdoch wants to merge 7 commits intoSnapDrop:masterfrom
schlagmichdoch:fix_socket_closing
Open

[stability] fix socket closing when peer leaves#556
schlagmichdoch wants to merge 7 commits intoSnapDrop:masterfrom
schlagmichdoch:fix_socket_closing

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

1 participant