Skip to content

Close pending WebRTC peers when watch permission is revoked - #37

Closed
yummybomb wants to merge 1 commit into
hypeship/destroy-half-open-webrtc-peerfrom
hypeship/webrtc-profile-permissions
Closed

yummybomb wants to merge 1 commit into
hypeship/destroy-half-open-webrtc-peerfrom
hypeship/webrtc-profile-permissions

Conversation

@yummybomb

@yummybomb yummybomb commented Nov 18, 2026 •

Copy link
Copy Markdown

Stacked on #33.

Summary

Revoking watch permission should close the session's WebRTC peer even if it hasn't started streaming. Keep the one-second delay for legacy clients, but don't use IsWatching to decide whether to schedule cleanup.

When the timer fires, check the current permissions and select the peer before releasing the profile lock. Close that peer outside the locks. If permission was restored in the meantime, a replacement peer is left alone.

Testing

The session tests cover a pending peer when permission stays revoked, and a replacement peer (pending or streaming) when permission is restored before the timer fires.

From server/, go test ./..., go test -race -count=20 ./internal/session ./internal/webrtc, and go vet ./internal/session ./internal/webrtc passed.

@yummybomb
yummybomb added this pull request to stack #38 November 18, 2026 21:03
@yummybomb yummybomb changed the title Recheck watch permission before closing the WebRTC peer Close pending WebRTC peers when watch permission is revoked Nov 18, 2026
@yummybomb
yummybomb force-pushed the hypeship/webrtc-profile-permissions branch from ef5b412 to d6275d1 Compare November 18, 2026 21:40
@yummybomb yummybomb closed this Nov 20, 2026
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