fix: don't unlock active in startup catch when a newer attempt owns it
The startup catch cleared this.active unconditionally. In a stop()+restart race during the slow login/pauses, the first attempt's catch would fire after the second start() had already taken the lock, unlocking it mid-startup and letting a third start() race in. Guard the active/state reset with `this.controller === controller`, matching the field-null and playStream .finally guards. Verified live: stop during login then restart keeps the restart's lock (active stays true), and it clears to false only once truly stopped; no crash.
This commit is contained in:
@@ -197,10 +197,16 @@ export class SelfbotStreamer implements ScreenStreamer {
|
|||||||
} catch {
|
} catch {
|
||||||
/* ignore */
|
/* ignore */
|
||||||
}
|
}
|
||||||
if (this.capture === capture) this.capture = null;
|
// Only release the lock / clear instance state if WE are still the
|
||||||
if (this.streamer === streamer) this.streamer = null;
|
// current attempt. If a concurrent stop()+start() already replaced the
|
||||||
if (this.controller === controller) this.controller = null;
|
// controller, a newer start() owns `active` — clearing it here would
|
||||||
this.active = false;
|
// unlock it mid-startup and let a third start() race in.
|
||||||
|
if (this.controller === controller) {
|
||||||
|
if (this.capture === capture) this.capture = null;
|
||||||
|
if (this.streamer === streamer) this.streamer = null;
|
||||||
|
this.controller = null;
|
||||||
|
this.active = false;
|
||||||
|
}
|
||||||
if (signal.aborted) return "송출을 시작하는 중에 중지했습니다.";
|
if (signal.aborted) return "송출을 시작하는 중에 중지했습니다.";
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user