mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 17:59:50 +02:00
feat(adb): auto close connection by default
This commit is contained in:
parent
2835848800
commit
b066ca01e7
4 changed files with 38 additions and 21 deletions
|
@ -28,6 +28,10 @@ export interface AdbPacketDispatcherOptions {
|
|||
*/
|
||||
appendNullToServiceString: boolean;
|
||||
maxPayloadSize: number;
|
||||
/**
|
||||
* Whether to preserve the connection open after the `AdbPacketDispatcher` is closed.
|
||||
*/
|
||||
preserveConnection?: boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,12 +118,7 @@ export class AdbPacketDispatcher implements Closeable {
|
|||
},
|
||||
}),
|
||||
{
|
||||
// There are multiple reasons for the pipe to stop,
|
||||
// (device disconnection, protocol error, or user abortion)
|
||||
// if the underlying streams are still open,
|
||||
// it's still possible to create another ADB connection.
|
||||
// So don't close `readable` here.
|
||||
preventCancel: true,
|
||||
preventCancel: options.preserveConnection ?? false,
|
||||
signal: this.#readAbortController.signal,
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue