Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 8223d798 authored by Simon Chan's avatar Simon Chan
Browse files

refactor: performance optimizations

also renamed some internal types, and adding more code comments. (not thoroughly tested yet)
parent 65b8671b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@
        "tslib": "^2.6.2"
    },
    "devDependencies": {
        "@types/node": "^20.12.7",
        "@types/node": "^20.12.8",
        "@yume-chan/eslint-config": "workspace:^1.0.0",
        "@yume-chan/tsconfig": "workspace:^1.0.0",
        "jest": "^30.0.0-alpha.3",
+83 −83

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
  "pnpmShrinkwrapHash": "c1a7aa8a614d364cced2ff0b11ae2cd00e133961",
  "pnpmShrinkwrapHash": "ca7743cb8480b533789651d98878a7900c9455fa",
  "preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"
}
+3 −3
Original line number Diff line number Diff line
@@ -333,10 +333,10 @@ export class AdbScrcpyClient {
    async #parseDeviceMessages(controlStream: ReadableStream<Uint8Array>) {
        const buffered = new BufferedReadableStream(controlStream);
        while (true) {
            const type = await buffered.readExactly(1);
            if (!(await this.#options.parseDeviceMessage(type[0]!, buffered))) {
            const [type] = await buffered.readExactly(1);
            if (!(await this.#options.parseDeviceMessage(type!, buffered))) {
                buffered
                    .cancel(new Error(`Unknown device message type ${type[0]}`))
                    .cancel(new Error(`Unknown device message type ${type!}`))
                    .catch(() => {});
                break;
            }
+9 −0
Original line number Diff line number Diff line
@@ -94,6 +94,15 @@ export class AdbScrcpyForwardConnection extends AdbScrcpyConnection {
                    const buffered = new BufferedReadableStream(
                        stream.readable,
                    );
                    // Skip the dummy byte
                    // Google ADB forward tunnel listens on a socket on the computer,
                    // when a client connects to that socket, Google ADB will forward
                    // the connection to the socket on the device.
                    // However, connecting to that socket will always succeed immediately,
                    // which doesn't mean that Google ADB has connected to
                    // the socket on the device.
                    // Thus Scrcpy server sends a dummy byte to the socket, to let the client
                    // know that the connection is truly established.
                    await buffered.readExactly(1);
                    return {
                        readable: buffered.release(),
Loading