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
This commit is contained in:
Jerry Zhang 2017-02-10 17:45:27 -08:00
parent 55205a565b
commit 2f8c60b1cc
2 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -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");