| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "remoting/protocol/chromium_socket_factory.h" | 5 #include "remoting/protocol/chromium_socket_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 uint16_t min_port, | 122 uint16_t min_port, |
| 123 uint16_t max_port) { | 123 uint16_t max_port) { |
| 124 net::IPEndPoint local_endpoint; | 124 net::IPEndPoint local_endpoint; |
| 125 if (!jingle_glue::SocketAddressToIPEndPoint( | 125 if (!jingle_glue::SocketAddressToIPEndPoint( |
| 126 local_address, &local_endpoint)) { | 126 local_address, &local_endpoint)) { |
| 127 return false; | 127 return false; |
| 128 } | 128 } |
| 129 | 129 |
| 130 for (uint32_t port = min_port; port <= max_port; ++port) { | 130 for (uint32_t port = min_port; port <= max_port; ++port) { |
| 131 socket_.reset(new net::UDPServerSocket(nullptr, net::NetLog::Source())); | 131 socket_.reset(new net::UDPServerSocket(nullptr, net::NetLog::Source())); |
| 132 int result = socket_->Listen( | 132 int result = socket_->Listen(net::IPEndPoint( |
| 133 net::IPEndPoint(local_endpoint.address(), static_cast<uint16_t>(port))); | 133 local_endpoint.address_number(), static_cast<uint16_t>(port))); |
| 134 if (result == net::OK) { | 134 if (result == net::OK) { |
| 135 break; | 135 break; |
| 136 } else { | 136 } else { |
| 137 socket_.reset(); | 137 socket_.reset(); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (!socket_.get()) { | 141 if (!socket_.get()) { |
| 142 // Failed to bind the socket. | 142 // Failed to bind the socket. |
| 143 return false; | 143 return false; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 return nullptr; | 396 return nullptr; |
| 397 } | 397 } |
| 398 | 398 |
| 399 rtc::AsyncResolverInterface* | 399 rtc::AsyncResolverInterface* |
| 400 ChromiumPacketSocketFactory::CreateAsyncResolver() { | 400 ChromiumPacketSocketFactory::CreateAsyncResolver() { |
| 401 return new rtc::AsyncResolver(); | 401 return new rtc::AsyncResolver(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 } // namespace protocol | 404 } // namespace protocol |
| 405 } // namespace remoting | 405 } // namespace remoting |
| OLD | NEW |