fix: await attested owned host during slow startup registration
This commit is contained in:
@@ -132,7 +132,18 @@ export class HostController {
|
||||
while (Date.now() < deadline) {
|
||||
if (failure || child.exitCode !== null) throw hostError('所属宿主启动失败,请查看本机启动记录。', 'HOST_START_FAILED');
|
||||
await delay(100);
|
||||
const health = await this.health();
|
||||
let health;
|
||||
try { health = await this.health(); }
|
||||
catch (cause) {
|
||||
if (cause.code !== 'HOST_PORT_UNVERIFIED') throw cause;
|
||||
const waiting = observeWindowsProcess(child.pid);
|
||||
if (!waiting || !observedChild || waiting.createdAt !== observedChild.createdAt || waiting.userSid !== observedChild.userSid
|
||||
|| !samePath(waiting.executable, this.node.path)) throw hostError('所属宿主启动进程已结束或身份变化,请核对原日志。', 'HOST_START_FAILED');
|
||||
// Registration can still occupy this owned process after listen().
|
||||
// Retry only observation, within the original deadline; never launch
|
||||
// another host or accept a connection without the complete proof.
|
||||
continue;
|
||||
}
|
||||
if (!health) continue;
|
||||
if (health.pid !== child.pid) throw hostError('启动期间端口被其他进程占用。');
|
||||
const connected = await this.connect(); if (connected) {
|
||||
|
||||
Reference in New Issue
Block a user