OLD | NEW |
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 <errno.h> | 5 #include <errno.h> |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <sys/wait.h> | 10 #include <sys/wait.h> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if (controllers_->find(controller_key) != controllers_->end()) { | 192 if (controllers_->find(controller_key) != controllers_->end()) { |
193 LOG(INFO) << "Already forwarding device port " << device_port | 193 LOG(INFO) << "Already forwarding device port " << device_port |
194 << " to host port " << host_port; | 194 << " to host port " << host_port; |
195 SendMessage(base::StringPrintf("%d:%d", device_port, host_port), | 195 SendMessage(base::StringPrintf("%d:%d", device_port, host_port), |
196 client_socket.get()); | 196 client_socket.get()); |
197 return; | 197 return; |
198 } | 198 } |
199 } | 199 } |
200 // Create a new host controller. | 200 // Create a new host controller. |
201 std::unique_ptr<HostController> host_controller(HostController::Create( | 201 std::unique_ptr<HostController> host_controller(HostController::Create( |
202 device_port, host_port, adb_port, GetExitNotifierFD(), | 202 device_serial, device_port, host_port, adb_port, GetExitNotifierFD(), |
203 base::Bind(&HostControllersManager::DeleteHostController, | 203 base::Bind(&HostControllersManager::DeleteHostController, |
204 weak_ptr_factory_.GetWeakPtr()))); | 204 weak_ptr_factory_.GetWeakPtr()))); |
205 if (!host_controller.get()) { | 205 if (!host_controller.get()) { |
206 has_failed_ = true; | 206 has_failed_ = true; |
207 SendMessage("ERROR: Connection to device failed.\n", client_socket.get()); | 207 SendMessage("ERROR: Connection to device failed.\n", client_socket.get()); |
208 LogExistingControllers(client_socket); | 208 LogExistingControllers(client_socket); |
209 return; | 209 return; |
210 } | 210 } |
211 // Get the current allocated port. | 211 // Get the current allocated port. |
212 device_port = host_controller->device_port(); | 212 device_port = host_controller->device_port(); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 return client_delegate.has_failed() || daemon_delegate.has_failed(); | 472 return client_delegate.has_failed() || daemon_delegate.has_failed(); |
473 } | 473 } |
474 | 474 |
475 } // namespace | 475 } // namespace |
476 } // namespace forwarder2 | 476 } // namespace forwarder2 |
477 | 477 |
478 int main(int argc, char** argv) { | 478 int main(int argc, char** argv) { |
479 return forwarder2::RunHostForwarder(argc, argv); | 479 return forwarder2::RunHostForwarder(argc, argv); |
480 } | 480 } |
OLD | NEW |