handle = peek(this.handles); handle.close(), remove(handle); } return this.handle?.stop(!1), this.handle = null, !0; } distribute(err, handle) { if (err) return; append(this.handles, handle); let [workerEntry] = this.free; if (ArrayIsArray(workerEntry)) { let { 0: workerId, 1: worker } = workerEntry; this.free.delete(workerId), this.handoff(worker); } } handoff(worker) { if (!this.all.has(worker.id)) return; let handle = peek(this.handles); if (handle === null) { this.free.set(worker.id, worker); return; } remove(handle); let message = { act: "newconn", key: this.key }; sendHelper(worker.process[kHandle], message, handle, (reply) => { if (reply.accepted) handle.close(); else this.distribute(0, handle); this.handoff(worker); }); } }; return $})