summaryrefslogtreecommitdiff
path: root/services.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-08-03 10:38:08 -0700
committerElliott Hughes <enh@google.com>2015-08-24 11:15:01 -0700
commit6b5effececbe8a24b6787f645c811bea019640dc (patch)
tree05b8a3794af4a8f2d5eefbf1810811e25a3def46 /services.cpp
parent9ae2adb29cf055f301d685585691f5c0984310dd (diff)
downloadadb-6b5effececbe8a24b6787f645c811bea019640dc.tar.gz
adb sync cleanup.
We can double the speed of "adb sync" (on N9) if we increase SYNC_DATA_MAX from 64KiB to 256KiB. This change doesn't do that, because I still haven't managed to plumb through the information about whether we're a new adb/adbd to file_sync_client.cpp and file_sync_service.cpp. But this is already a big change with a lot of cleanup, so let's do the cleanup and worry about the intended change another day... This change does improve performance somewhat by halving the number of lstat(2) calls made on the client side, and ensuring that most packets are sent with a single write. This has the pleasing result of making the null sync on an AOSP N9 go from just over 300ms to around 100ms, which means it now seems instantaneous (https://en.wikipedia.org/wiki/Mental_chronometry). Change-Id: If9f6d4c1f93ec752b95f71211bbbb1c513045166
Diffstat (limited to 'services.cpp')
-rw-r--r--services.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/services.cpp b/services.cpp
index 255be09..c8c2d54 100644
--- a/services.cpp
+++ b/services.cpp
@@ -438,8 +438,7 @@ static int create_subproc_thread(const char *name, SubprocessType type) {
}
#endif
-int service_to_fd(const char *name)
-{
+int service_to_fd(const char* name) {
int ret = -1;
if(!strncmp(name, "tcp:", 4)) {
@@ -503,13 +502,11 @@ int service_to_fd(const char *name)
} else if(!strncmp(name, "unroot:", 7)) {
ret = create_service_thread(restart_unroot_service, NULL);
} else if(!strncmp(name, "backup:", 7)) {
- ret = create_subproc_thread(
- android::base::StringPrintf("/system/bin/bu backup %s",
- (name + 7)).c_str(),
- SubprocessType::kRaw);
- } else if(!strncmp(name, "restore:", 8)) {
- ret = create_subproc_thread("/system/bin/bu restore",
+ ret = create_subproc_thread(android::base::StringPrintf("/system/bin/bu backup %s",
+ (name + 7)).c_str(),
SubprocessType::kRaw);
+ } else if(!strncmp(name, "restore:", 8)) {
+ ret = create_subproc_thread("/system/bin/bu restore", SubprocessType::kRaw);
} else if(!strncmp(name, "tcpip:", 6)) {
int port;
if (sscanf(name + 6, "%d", &port) != 1) {
@@ -667,8 +664,7 @@ static void connect_service(int fd, void* data) {
#endif
#if ADB_HOST
-asocket* host_service_to_socket(const char* name, const char *serial)
-{
+asocket* host_service_to_socket(const char* name, const char* serial) {
if (!strcmp(name,"track-devices")) {
return create_device_tracker();
} else if (!strncmp(name, "wait-for-", strlen("wait-for-"))) {