Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: tools/android/forwarder2/host_controller.cc

Issue 10957052: Adapt python scripts to use the new Forwarder2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/android/forwarder2/host_controller.h" 5 #include "tools/android/forwarder2/host_controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 forwarder->Start(); 61 forwarder->Start();
62 } 62 }
63 63
64 bool HostController::Connect() { 64 bool HostController::Connect() {
65 if (!adb_control_socket_.ConnectTcp("", adb_port_)) { 65 if (!adb_control_socket_.ConnectTcp("", adb_port_)) {
66 LOG(ERROR) << "Could not Connect HostController socket on port: " 66 LOG(ERROR) << "Could not Connect HostController socket on port: "
67 << adb_port_; 67 << adb_port_;
68 return false; 68 return false;
69 } 69 }
70 // Send the command to the device start listening to the "device_forward_port" 70 // Send the command to the device start listening to the "device_forward_port"
71 SendCommand(command::LISTEN, device_port_, &adb_control_socket_); 71 CHECK(SendCommand(command::LISTEN, device_port_, &adb_control_socket_));
bulach 2012/09/26 15:13:11 nit: it's fairly uncommon to call non-const method
felipeg 2012/09/26 18:06:03 Done.
72 int device_port_allocated; 72 int device_port_allocated;
73 command::Type command; 73 command::Type command;
74 if (!ReadCommand(&adb_control_socket_, &device_port_allocated, &command) || 74 if (!ReadCommand(&adb_control_socket_, &device_port_allocated, &command) ||
75 command != command::BIND_SUCCESS) { 75 command != command::BIND_SUCCESS) {
76 LOG(ERROR) << "Device binding error using port " << device_port_; 76 LOG(ERROR) << "Device binding error using port " << device_port_;
77 adb_control_socket_.Close(); 77 adb_control_socket_.Close();
78 return false; 78 return false;
79 } 79 }
80 // When doing dynamically allocation of port, we get the port from the 80 // When doing dynamically allocation of port, we get the port from the
81 // BIND_SUCCESS command we received above. 81 // BIND_SUCCESS command we received above.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 SendCommand(command::HOST_SERVER_SUCCESS, 115 SendCommand(command::HOST_SERVER_SUCCESS,
116 device_port_, 116 device_port_,
117 &adb_control_socket_); 117 &adb_control_socket_);
118 StartForwarder(host_server_data_socket.Pass()); 118 StartForwarder(host_server_data_socket.Pass());
119 } 119 }
120 adb_control_socket_.Close(); 120 adb_control_socket_.Close();
121 } 121 }
122 122
123 } // namespace forwarder2 123 } // namespace forwarder2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698