diff options
Diffstat (limited to 'adb/transport_local.cpp')
-rw-r--r-- | adb/transport_local.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/adb/transport_local.cpp b/adb/transport_local.cpp index 4198a5247..3ee286a12 100644 --- a/adb/transport_local.cpp +++ b/adb/transport_local.cpp | |||
@@ -199,7 +199,7 @@ static std::vector<RetryPort>& retry_ports = *new std::vector<RetryPort>; | |||
199 | std::mutex &retry_ports_lock = *new std::mutex; | 199 | std::mutex &retry_ports_lock = *new std::mutex; |
200 | std::condition_variable &retry_ports_cond = *new std::condition_variable; | 200 | std::condition_variable &retry_ports_cond = *new std::condition_variable; |
201 | 201 | ||
202 | static void client_socket_thread(void* x) { | 202 | static void client_socket_thread(int) { |
203 | adb_thread_setname("client_socket_thread"); | 203 | adb_thread_setname("client_socket_thread"); |
204 | D("transport: client_socket_thread() starting"); | 204 | D("transport: client_socket_thread() starting"); |
205 | PollAllLocalPortsForEmulator(); | 205 | PollAllLocalPortsForEmulator(); |
@@ -244,9 +244,8 @@ static void client_socket_thread(void* x) { | |||
244 | 244 | ||
245 | #else // ADB_HOST | 245 | #else // ADB_HOST |
246 | 246 | ||
247 | static void server_socket_thread(void* arg) { | 247 | static void server_socket_thread(int port) { |
248 | int serverfd, fd; | 248 | int serverfd, fd; |
249 | int port = (int) (uintptr_t) arg; | ||
250 | 249 | ||
251 | adb_thread_setname("server socket"); | 250 | adb_thread_setname("server socket"); |
252 | D("transport: server_socket_thread() starting"); | 251 | D("transport: server_socket_thread() starting"); |
@@ -325,7 +324,7 @@ static void server_socket_thread(void* arg) { | |||
325 | * the transport registration is completed. That's why we need to send the | 324 | * the transport registration is completed. That's why we need to send the |
326 | * 'start' request after the transport is registered. | 325 | * 'start' request after the transport is registered. |
327 | */ | 326 | */ |
328 | static void qemu_socket_thread(void* arg) { | 327 | static void qemu_socket_thread(int port) { |
329 | /* 'accept' request to the adb QEMUD service. */ | 328 | /* 'accept' request to the adb QEMUD service. */ |
330 | static const char _accept_req[] = "accept"; | 329 | static const char _accept_req[] = "accept"; |
331 | /* 'start' request to the adb QEMUD service. */ | 330 | /* 'start' request to the adb QEMUD service. */ |
@@ -333,7 +332,6 @@ static void qemu_socket_thread(void* arg) { | |||
333 | /* 'ok' reply from the adb QEMUD service. */ | 332 | /* 'ok' reply from the adb QEMUD service. */ |
334 | static const char _ok_resp[] = "ok"; | 333 | static const char _ok_resp[] = "ok"; |
335 | 334 | ||
336 | const int port = (int) (uintptr_t) arg; | ||
337 | int fd; | 335 | int fd; |
338 | char tmp[256]; | 336 | char tmp[256]; |
339 | char con_name[32]; | 337 | char con_name[32]; |
@@ -350,7 +348,7 @@ static void qemu_socket_thread(void* arg) { | |||
350 | /* This could be an older version of the emulator, that doesn't | 348 | /* This could be an older version of the emulator, that doesn't |
351 | * implement adb QEMUD service. Fall back to the old TCP way. */ | 349 | * implement adb QEMUD service. Fall back to the old TCP way. */ |
352 | D("adb service is not available. Falling back to TCP socket."); | 350 | D("adb service is not available. Falling back to TCP socket."); |
353 | adb_thread_create(server_socket_thread, arg); | 351 | std::thread(server_socket_thread, port).detach(); |
354 | return; | 352 | return; |
355 | } | 353 | } |
356 | 354 | ||
@@ -394,7 +392,7 @@ static void qemu_socket_thread(void* arg) { | |||
394 | 392 | ||
395 | void local_init(int port) | 393 | void local_init(int port) |
396 | { | 394 | { |
397 | adb_thread_func_t func; | 395 | void (*func)(int); |
398 | const char* debug_name = ""; | 396 | const char* debug_name = ""; |
399 | 397 | ||
400 | #if ADB_HOST | 398 | #if ADB_HOST |
@@ -414,9 +412,7 @@ void local_init(int port) | |||
414 | #endif // !ADB_HOST | 412 | #endif // !ADB_HOST |
415 | 413 | ||
416 | D("transport: local %s init", debug_name); | 414 | D("transport: local %s init", debug_name); |
417 | if (!adb_thread_create(func, (void *) (uintptr_t) port)) { | 415 | std::thread(func, port).detach(); |
418 | fatal_errno("cannot create local socket %s thread", debug_name); | ||
419 | } | ||
420 | } | 416 | } |
421 | 417 | ||
422 | static void remote_kick(atransport *t) | 418 | static void remote_kick(atransport *t) |
@@ -519,12 +515,11 @@ int init_socket_transport(atransport *t, int s, int adb_port, int local) | |||
519 | int fail = 0; | 515 | int fail = 0; |
520 | 516 | ||
521 | t->SetKickFunction(remote_kick); | 517 | t->SetKickFunction(remote_kick); |
518 | t->SetWriteFunction(remote_write); | ||
522 | t->close = remote_close; | 519 | t->close = remote_close; |
523 | t->read_from_remote = remote_read; | 520 | t->read_from_remote = remote_read; |
524 | t->write_to_remote = remote_write; | ||
525 | t->sfd = s; | 521 | t->sfd = s; |
526 | t->sync_token = 1; | 522 | t->sync_token = 1; |
527 | t->connection_state = kCsOffline; | ||
528 | t->type = kTransportLocal; | 523 | t->type = kTransportLocal; |
529 | 524 | ||
530 | #if ADB_HOST | 525 | #if ADB_HOST |