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 "content/renderer/p2p/ipc_socket_factory.h" | 5 #include "content/renderer/p2p/ipc_socket_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 remote_address_ = remote_address; | 228 remote_address_ = remote_address; |
229 state_ = IS_OPENING; | 229 state_ = IS_OPENING; |
230 | 230 |
231 net::IPEndPoint local_endpoint; | 231 net::IPEndPoint local_endpoint; |
232 if (!jingle_glue::SocketAddressToIPEndPoint( | 232 if (!jingle_glue::SocketAddressToIPEndPoint( |
233 local_address, &local_endpoint)) { | 233 local_address, &local_endpoint)) { |
234 return false; | 234 return false; |
235 } | 235 } |
236 | 236 |
237 net::IPEndPoint remote_endpoint; | 237 net::IPEndPoint remote_endpoint; |
238 if (!remote_address.IsNil() && !jingle_glue::SocketAddressToIPEndPoint( | 238 if (!remote_address.IsNil() && |
Sergey Ulanov
2014/08/14 20:47:24
I suggest formatting this code as follows to make
jiayl
2014/08/14 22:31:47
That isn't the same logic.
1. The DCHECK is not t
jiayl
2014/08/15 00:05:33
I would rather just fix the hostname issue instead
Sergey Ulanov
2014/08/15 00:37:06
What are the cases when it's not true? remote_addr
Sergey Ulanov
2014/08/15 00:37:06
I don't think it changes logic if you take into ac
jiayl
2014/08/15 16:23:11
OK. That makes sense. done.
On 2014/08/15 00:37:0
| |
239 remote_address, &remote_endpoint) && !IsTcpClientSocket(type_)) { | 239 (remote_address.IsUnresolvedIP() || |
240 !jingle_glue::SocketAddressToIPEndPoint(remote_address, | |
241 &remote_endpoint)) && | |
242 !IsTcpClientSocket(type_)) { | |
240 // Non TCP sockets must have a resolved remote address. | 243 // Non TCP sockets must have a resolved remote address. |
241 return false; | 244 return false; |
242 } | 245 } |
243 | 246 |
247 if (remote_address.IsUnresolvedIP()) { | |
248 remote_endpoint = | |
249 net::IPEndPoint(net::IPAddressNumber(), remote_address.port()); | |
250 } | |
251 | |
244 // We need to send both resolved and unresolved address in Init. Unresolved | 252 // We need to send both resolved and unresolved address in Init. Unresolved |
245 // address will be used in case of TLS for certificate hostname matching. | 253 // address will be used in case of TLS for certificate hostname matching. |
246 // Certificate will be tied to domain name not to IP address. | 254 // Certificate will be tied to domain name not to IP address. |
247 std::string remote_hostname = remote_address.hostname() + ":" + | 255 P2PHostAndIPEndPoint remote_info(remote_address.hostname(), remote_endpoint); |
248 remote_address.PortAsString(); | |
249 P2PHostAndIPEndPoint remote_info(remote_hostname, remote_endpoint); | |
250 | 256 |
251 client->Init(type, local_endpoint, remote_info, this); | 257 client->Init(type, local_endpoint, remote_info, this); |
252 | 258 |
253 return true; | 259 return true; |
254 } | 260 } |
255 | 261 |
256 void IpcPacketSocket::InitAcceptedTcp( | 262 void IpcPacketSocket::InitAcceptedTcp( |
257 P2PSocketClient* client, | 263 P2PSocketClient* client, |
258 const rtc::SocketAddress& local_address, | 264 const rtc::SocketAddress& local_address, |
259 const rtc::SocketAddress& remote_address) { | 265 const rtc::SocketAddress& remote_address) { |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
664 } | 670 } |
665 | 671 |
666 rtc::AsyncResolverInterface* | 672 rtc::AsyncResolverInterface* |
667 IpcPacketSocketFactory::CreateAsyncResolver() { | 673 IpcPacketSocketFactory::CreateAsyncResolver() { |
668 scoped_ptr<AsyncAddressResolverImpl> resolver( | 674 scoped_ptr<AsyncAddressResolverImpl> resolver( |
669 new AsyncAddressResolverImpl(socket_dispatcher_)); | 675 new AsyncAddressResolverImpl(socket_dispatcher_)); |
670 return resolver.release(); | 676 return resolver.release(); |
671 } | 677 } |
672 | 678 |
673 } // namespace content | 679 } // namespace content |
OLD | NEW |