fix(adb): close writable stream when closing AdbDaemonTransport

This commit is contained in:
Simon Chan 2023-08-15 15:25:47 +08:00
parent 637d1f9bf8
commit e185d6a7c6
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
3 changed files with 28 additions and 6 deletions

View file

@ -305,8 +305,13 @@ export class AdbPacketDispatcher implements Closeable {
// It's possible that we haven't received all `CLSE` confirm packets,
// but it doesn't matter, the next connection can cope with them.
this.#closed = true;
this.#readAbortController.abort();
this.#writer.releaseLock();
if (this.options.preserveConnection ?? false) {
this.#writer.releaseLock();
} else {
await this.#writer.close();
}
// `pipe().then()` will call `dispose`
}