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

Unified Diff: tools/android/forwarder2/host_forwarder_main.cc

Issue 18051018: Make host_forwarder better handle duplicate forwards. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Marcus' comments Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/forwarder2/host_forwarder_main.cc
diff --git a/tools/android/forwarder2/host_forwarder_main.cc b/tools/android/forwarder2/host_forwarder_main.cc
index 82bb7a841b7fba5db25de5fe28f8e51758e410f3..77c0b13cb4b452de2f0375cd031c7bd018c9b212 100644
--- a/tools/android/forwarder2/host_forwarder_main.cc
+++ b/tools/android/forwarder2/host_forwarder_main.cc
@@ -134,6 +134,18 @@ class ServerDelegate : public Daemon::ServerDelegate {
SendMessage("ERROR: missing host port", client_socket.get());
return;
}
+ const bool use_dynamic_port_allocation = device_port == 0;
+ if (!use_dynamic_port_allocation) {
+ const std::string controller_key = MakeHostControllerMapKey(
+ adb_port, device_port);
+ LOG(INFO) << "Already forwarding device port " << device_port
+ << " to host port " << host_port;
+ if (controllers_.find(controller_key) != controllers_.end()) {
+ SendMessage(base::StringPrintf("%d:%d", device_port, host_port),
+ client_socket.get());
+ return;
+ }
+ }
// Create a new host controller.
scoped_ptr<HostController> host_controller(
new HostController(device_port, "127.0.0.1", host_port, adb_port,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698