Chromium Code Reviews| 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()))); |