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

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: 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..56172736653c09e0938ace70dc0f4b896205a8d9 100644
--- a/tools/android/forwarder2/host_forwarder_main.cc
+++ b/tools/android/forwarder2/host_forwarder_main.cc
@@ -134,6 +134,14 @@ class ServerDelegate : public Daemon::ServerDelegate {
SendMessage("ERROR: missing host port", client_socket.get());
return;
}
+ const std::string controller_key = MakeHostControllerMapKey(
+ adb_port, device_port);
+ if (controllers_.find(controller_key) != controllers_.end()) {
+ // The port is already forwarded.
bulach 2013/07/08 14:35:36 nit: maybe expand this a little bit, and add a log
Philippe 2013/07/08 15:47:50 Note that this wasn't unfortunately doing what you
Philippe 2013/07/08 17:00:38 The other patch set I mentioned is a much bigger c
bulach 2013/07/08 17:40:35 sgtm.. would you like to add the LOG just in case,
+ 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,
@@ -151,8 +159,6 @@ class ServerDelegate : public Daemon::ServerDelegate {
if (!SendMessage(msg, client_socket.get()))
return;
host_controller->Start();
- const std::string controller_key = MakeHostControllerMapKey(
- adb_port, device_port);
controllers_.insert(
std::make_pair(controller_key,
linked_ptr<HostController>(host_controller.release())));
« 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