publish: drop a queued request when the client leaves

notifystreamclientleft only removed connected viewers, so a request that
was still waiting for a decision outlived the person who made it - the
row stayed in the panel and approving it would have opened a connection
to a client that is gone. Leaving while pending is not exotic: it is what
closing TS6, or giving up on "waiting for access", looks like from here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5 committed 2026-09-11 05:26:33 +00:00
1 parent 13d3f56c89
commit b505d68f56
1 file changed
+5 -2
+5 -2
View File
@@ -219,8 +219,6 @@ export class StreamPublisher {
// is_remove=1 is how TS6 says "stop watching"; the same notify carries it.
if (args.is_remove === "1") {
this.dropViewer(clid);
this.pending.delete(clid);
this.notifyPending();
return;
}
if (this.viewers.has(clid) || this.pending.has(clid)) return;
@@ -421,6 +419,11 @@ export class StreamPublisher {
}
private dropViewer(clid: number): void {
// Someone can also leave while their request is still queued - by closing
// TS6, or by giving up on "waiting for access". The row has to go with
// them, or the user is left approving a viewer who is no longer there.
if (this.pending.delete(clid)) this.notifyPending();
const viewer = this.viewers.get(clid);
if (!viewer) return;
this.viewers.delete(clid);