| 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 <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "jingle/glue/utils.h" | 17 #include "jingle/glue/utils.h" |
| 18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/log/net_log_source.h" |
| 21 #include "net/udp/udp_server_socket.h" | 22 #include "net/udp/udp_server_socket.h" |
| 22 #include "remoting/protocol/socket_util.h" | 23 #include "remoting/protocol/socket_util.h" |
| 23 #include "third_party/webrtc/base/asyncpacketsocket.h" | 24 #include "third_party/webrtc/base/asyncpacketsocket.h" |
| 24 #include "third_party/webrtc/base/nethelpers.h" | 25 #include "third_party/webrtc/base/nethelpers.h" |
| 25 #include "third_party/webrtc/base/socket.h" | 26 #include "third_party/webrtc/base/socket.h" |
| 26 #include "third_party/webrtc/media/base/rtputils.h" | 27 #include "third_party/webrtc/media/base/rtputils.h" |
| 27 | 28 |
| 28 namespace remoting { | 29 namespace remoting { |
| 29 namespace protocol { | 30 namespace protocol { |
| 30 | 31 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 bool UdpPacketSocket::Init(const rtc::SocketAddress& local_address, | 131 bool UdpPacketSocket::Init(const rtc::SocketAddress& local_address, |
| 131 uint16_t min_port, | 132 uint16_t min_port, |
| 132 uint16_t max_port) { | 133 uint16_t max_port) { |
| 133 net::IPEndPoint local_endpoint; | 134 net::IPEndPoint local_endpoint; |
| 134 if (!jingle_glue::SocketAddressToIPEndPoint( | 135 if (!jingle_glue::SocketAddressToIPEndPoint( |
| 135 local_address, &local_endpoint)) { | 136 local_address, &local_endpoint)) { |
| 136 return false; | 137 return false; |
| 137 } | 138 } |
| 138 | 139 |
| 139 for (uint32_t port = min_port; port <= max_port; ++port) { | 140 for (uint32_t port = min_port; port <= max_port; ++port) { |
| 140 socket_.reset(new net::UDPServerSocket(nullptr, net::NetLog::Source())); | 141 socket_.reset(new net::UDPServerSocket(nullptr, net::NetLogSource())); |
| 141 int result = socket_->Listen( | 142 int result = socket_->Listen( |
| 142 net::IPEndPoint(local_endpoint.address(), static_cast<uint16_t>(port))); | 143 net::IPEndPoint(local_endpoint.address(), static_cast<uint16_t>(port))); |
| 143 if (result == net::OK) { | 144 if (result == net::OK) { |
| 144 break; | 145 break; |
| 145 } else { | 146 } else { |
| 146 socket_.reset(); | 147 socket_.reset(); |
| 147 } | 148 } |
| 148 } | 149 } |
| 149 | 150 |
| 150 if (!socket_.get()) { | 151 if (!socket_.get()) { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 return nullptr; | 417 return nullptr; |
| 417 } | 418 } |
| 418 | 419 |
| 419 rtc::AsyncResolverInterface* | 420 rtc::AsyncResolverInterface* |
| 420 ChromiumPacketSocketFactory::CreateAsyncResolver() { | 421 ChromiumPacketSocketFactory::CreateAsyncResolver() { |
| 421 return new rtc::AsyncResolver(); | 422 return new rtc::AsyncResolver(); |
| 422 } | 423 } |
| 423 | 424 |
| 424 } // namespace protocol | 425 } // namespace protocol |
| 425 } // namespace remoting | 426 } // namespace remoting |
| OLD | NEW |