| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 556 |
| 557 SignalAddressReady(this, local_address_); | 557 SignalAddressReady(this, local_address_); |
| 558 if (IsTcpClientSocket(type_)) { | 558 if (IsTcpClientSocket(type_)) { |
| 559 // If remote address is unresolved, set resolved remote IP address received | 559 // If remote address is unresolved, set resolved remote IP address received |
| 560 // in the callback. This address will be used while sending the packets | 560 // in the callback. This address will be used while sending the packets |
| 561 // over the network. | 561 // over the network. |
| 562 if (remote_address_.IsUnresolvedIP()) { | 562 if (remote_address_.IsUnresolvedIP()) { |
| 563 rtc::SocketAddress jingle_socket_address; | 563 rtc::SocketAddress jingle_socket_address; |
| 564 // |remote_address| could be unresolved if the connection is behind a | 564 // |remote_address| could be unresolved if the connection is behind a |
| 565 // proxy. | 565 // proxy. |
| 566 if (!remote_address.address().empty() && | 566 if (!remote_address.address_number().empty() && |
| 567 jingle_glue::IPEndPointToSocketAddress( | 567 jingle_glue::IPEndPointToSocketAddress(remote_address, |
| 568 remote_address, &jingle_socket_address)) { | 568 &jingle_socket_address)) { |
| 569 // Set only the IP address. | 569 // Set only the IP address. |
| 570 remote_address_.SetResolvedIP(jingle_socket_address.ipaddr()); | 570 remote_address_.SetResolvedIP(jingle_socket_address.ipaddr()); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 // SignalConnect after updating the |remote_address_| so that the listener | 574 // SignalConnect after updating the |remote_address_| so that the listener |
| 575 // can get the resolved remote address. | 575 // can get the resolved remote address. |
| 576 SignalConnect(this); | 576 SignalConnect(this); |
| 577 } | 577 } |
| 578 } | 578 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 } | 640 } |
| 641 } | 641 } |
| 642 | 642 |
| 643 void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address, | 643 void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address, |
| 644 const std::vector<char>& data, | 644 const std::vector<char>& data, |
| 645 const base::TimeTicks& timestamp) { | 645 const base::TimeTicks& timestamp) { |
| 646 DCHECK_EQ(base::MessageLoop::current(), message_loop_); | 646 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 647 | 647 |
| 648 rtc::SocketAddress address_lj; | 648 rtc::SocketAddress address_lj; |
| 649 | 649 |
| 650 if (address.address().empty()) { | 650 if (address.address_number().empty()) { |
| 651 DCHECK(IsTcpClientSocket(type_)); | 651 DCHECK(IsTcpClientSocket(type_)); |
| 652 // |address| could be empty for TCP connections behind a proxy. | 652 // |address| could be empty for TCP connections behind a proxy. |
| 653 address_lj = remote_address_; | 653 address_lj = remote_address_; |
| 654 } else { | 654 } else { |
| 655 if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { | 655 if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { |
| 656 // We should always be able to convert address here because we | 656 // We should always be able to convert address here because we |
| 657 // don't expect IPv6 address on IPv4 connections. | 657 // don't expect IPv6 address on IPv4 connections. |
| 658 NOTREACHED(); | 658 NOTREACHED(); |
| 659 return; | 659 return; |
| 660 } | 660 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 } | 801 } |
| 802 | 802 |
| 803 rtc::AsyncResolverInterface* | 803 rtc::AsyncResolverInterface* |
| 804 IpcPacketSocketFactory::CreateAsyncResolver() { | 804 IpcPacketSocketFactory::CreateAsyncResolver() { |
| 805 scoped_ptr<AsyncAddressResolverImpl> resolver( | 805 scoped_ptr<AsyncAddressResolverImpl> resolver( |
| 806 new AsyncAddressResolverImpl(socket_dispatcher_)); | 806 new AsyncAddressResolverImpl(socket_dispatcher_)); |
| 807 return resolver.release(); | 807 return resolver.release(); |
| 808 } | 808 } |
| 809 | 809 |
| 810 } // namespace content | 810 } // namespace content |
| OLD | NEW |