summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjbudorick <jbudorick@chromium.org>2015-08-12 09:49:34 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-12 16:50:21 +0000
commit92c4ad8af63e1eb18f21998e3bc37d5e1bd4e742 (patch)
treef2f95787076c70776377b0661c3d42fb5f64d6dc
parent27cc930af5f3f5c850179dd5ccd666c95eff2c50 (diff)
downloadchromium_src-92c4ad8af63e1eb18f21998e3bc37d5e1bd4e742.zip
chromium_src-92c4ad8af63e1eb18f21998e3bc37d5e1bd4e742.tar.gz
chromium_src-92c4ad8af63e1eb18f21998e3bc37d5e1bd4e742.tar.bz2
[Android] Log existing controllers on forwarder failure.
BUG= Review URL: https://codereview.chromium.org/1286193002 Cr-Commit-Position: refs/heads/master@{#343032}
-rw-r--r--tools/android/forwarder2/host_forwarder_main.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/android/forwarder2/host_forwarder_main.cc b/tools/android/forwarder2/host_forwarder_main.cc
index ddb56c09..8fdb91f 100644
--- a/tools/android/forwarder2/host_forwarder_main.cc
+++ b/tools/android/forwarder2/host_forwarder_main.cc
@@ -170,9 +170,12 @@ class HostControllersManager {
adb_port, -device_port);
const bool controller_did_exist = DeleteRefCountedValueInMap(
controller_key, controllers_.get());
- SendMessage(
- !controller_did_exist ? "ERROR: could not unmap port" : "OK",
- client_socket.get());
+ if (!controller_did_exist) {
+ SendMessage("ERROR: could not unmap port.", client_socket.get());
+ LogExistingControllers(client_socket);
+ } else {
+ SendMessage("OK", client_socket.get());
+ }
RemoveAdbPortForDeviceIfNeeded(adb_path, device_serial);
return;
@@ -202,6 +205,7 @@ class HostControllersManager {
if (!host_controller.get()) {
has_failed_ = true;
SendMessage("ERROR: Connection to device failed.", client_socket.get());
+ LogExistingControllers(client_socket);
return;
}
// Get the current allocated port.
@@ -217,6 +221,14 @@ class HostControllersManager {
linked_ptr<HostController>(host_controller.release())));
}
+ void LogExistingControllers(const scoped_ptr<Socket>& client_socket) {
+ SendMessage("ERROR: Existing controllers:", client_socket.get());
+ for (const auto& controller : *controllers_) {
+ SendMessage(base::StringPrintf("ERROR: %s", controller.first.c_str()),
+ client_socket.get());
+ }
+ }
+
void RemoveAdbPortForDeviceIfNeeded(const std::string& adb_path,
const std::string& device_serial) {
base::hash_map<std::string, int>::const_iterator it =