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

Commit 2f8c60b1 authored by Jerry Zhang's avatar Jerry Zhang
Browse files

adb: Set max socket sizes to larger values.

This improves performance of push/pull.

Test: adb push/pull multi GB files.
Bug: 31722483
Change-Id: Ia01574c3db6a740d7a7e64ba1f5bc1fc279fb3f6
parent 55205a56
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ constexpr size_t MAX_PAYLOAD_V1 = 4 * 1024;
constexpr size_t MAX_PAYLOAD_V2 = 256 * 1024;
constexpr size_t MAX_PAYLOAD = MAX_PAYLOAD_V2;

constexpr size_t LINUX_MAX_SOCKET_SIZE = 4194304;

#define A_SYNC 0x434e5953
#define A_CNXN 0x4e584e43
#define A_OPEN 0x4e45504f
+9 −0
Original line number Diff line number Diff line
@@ -242,6 +242,15 @@ static int create_service_thread(void (*func)(int, void *), void *cookie)
    }
    D("socketpair: (%d,%d)", s[0], s[1]);

#if !ADB_HOST
    if (func == &file_sync_service) {
        // Set file sync service socket to maximum size
        int max_buf = LINUX_MAX_SOCKET_SIZE;
        adb_setsockopt(s[0], SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
        adb_setsockopt(s[1], SOL_SOCKET, SO_SNDBUF, &max_buf, sizeof(max_buf));
    }
#endif // !ADB_HOST

    stinfo* sti = reinterpret_cast<stinfo*>(malloc(sizeof(stinfo)));
    if (sti == nullptr) {
        fatal("cannot allocate stinfo");