210
return;
211
}
213
>
// Register the request so {@link LoopbackProxyServer} aborts it on
214
>
// teardown; a client-side disconnect also flips `clientGone` and aborts.
215
>
// Both surface through the shared `AbortController`, which we re-check
216
>
// after the async bridge hop before touching the response.
217
>
const entry: IProxyInFlight = { ac: new AbortController(), res, clientGone: false };
218
>
runtime.inFlight.add(entry);
219
>
const onClose = () => {
220
entry.clientGone = true;
221
entry.ac.abort();
222
};
224
>
225
>
try {
226
>
const result = await connection.chat(bridgeRequest);
227
if (entry.ac.signal.aborted || res.writableEnded) {
228
return;