diff --git a/adb/adb.h b/adb/adb.h index 6a38f18e0..a30e29789 100644 --- a/adb/adb.h +++ b/adb/adb.h @@ -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 diff --git a/adb/services.cpp b/adb/services.cpp index df1b134bf..a48d85512 100644 --- a/adb/services.cpp +++ b/adb/services.cpp @@ -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(malloc(sizeof(stinfo))); if (sti == nullptr) { fatal("cannot allocate stinfo");