diff --git a/bot/src/stream/selfbot.ts b/bot/src/stream/selfbot.ts index 1b53749..48b2cf2 100644 --- a/bot/src/stream/selfbot.ts +++ b/bot/src/stream/selfbot.ts @@ -197,10 +197,16 @@ export class SelfbotStreamer implements ScreenStreamer { } catch { /* ignore */ } - if (this.capture === capture) this.capture = null; - if (this.streamer === streamer) this.streamer = null; - if (this.controller === controller) this.controller = null; - this.active = false; + // Only release the lock / clear instance state if WE are still the + // current attempt. If a concurrent stop()+start() already replaced the + // controller, a newer start() owns `active` — clearing it here would + // 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 "송출을 시작하는 중에 중지했습니다."; throw e; }