Index: content/renderer/p2p/ipc_socket_factory.cc |
diff --git a/content/renderer/p2p/ipc_socket_factory.cc b/content/renderer/p2p/ipc_socket_factory.cc |
index 4e46e46981e084938a4a010f0a22d997089e7e06..947e467dd22fd7909f2d39a67713d506767ca991 100644 |
--- a/content/renderer/p2p/ipc_socket_factory.cc |
+++ b/content/renderer/p2p/ipc_socket_factory.cc |
@@ -398,14 +398,18 @@ int IpcPacketSocket::SendTo(const void *data, size_t data_size, |
} |
net::IPEndPoint address_chrome; |
- if (!jingle_glue::SocketAddressToIPEndPoint(address, &address_chrome)) { |
- LOG(WARNING) << "Failed to convert remote address to IPEndPoint: address = " |
- << address.ipaddr().ToSensitiveString() |
- << ", remote_address_ = " |
- << remote_address_.ipaddr().ToSensitiveString(); |
- NOTREACHED(); |
- error_ = EINVAL; |
- return -1; |
+ if (address.IsUnresolvedIP()) { |
+ address_chrome = net::IPEndPoint(net::IPAddressNumber(), address.port()); |
juberti2
2014/12/11 19:23:50
I think we should check that address == remote_add
|
+ } else { |
+ if (!jingle_glue::SocketAddressToIPEndPoint(address, &address_chrome)) { |
+ LOG(WARNING) << "Failed to convert remote address to IPEndPoint: address=" |
+ << address.ipaddr().ToSensitiveString() |
+ << ", remote_address_=" |
+ << remote_address_.ipaddr().ToSensitiveString(); |
+ NOTREACHED(); |
+ error_ = EINVAL; |
+ return -1; |
+ } |
} |
send_bytes_available_ -= data_size; |
@@ -530,14 +534,15 @@ void IpcPacketSocket::OnOpen(const net::IPEndPoint& local_address, |
// over the network. |
if (remote_address_.IsUnresolvedIP()) { |
rtc::SocketAddress jingle_socket_address; |
- if (!jingle_glue::IPEndPointToSocketAddress( |
- remote_address, &jingle_socket_address)) { |
- LOG(WARNING) << "Failed to convert remote IPEndPoint to SocketAddress: " |
- << remote_address.ToString(); |
- NOTREACHED(); |
+ if (jingle_glue::IPEndPointToSocketAddress( |
+ remote_address, &jingle_socket_address)) { |
+ // Set only the IP address. |
+ remote_address_.SetResolvedIP(jingle_socket_address.ipaddr()); |
+ } else { |
+ // This could happen if the socket is connected through a proxy. |
+ VLOG(3) << "Failed to convert remote IPEndPoint to SocketAddress: " |
Sergey Ulanov
2014/12/11 19:09:17
Do we need to log it at all if it's expected?
juberti2
2014/12/11 19:23:50
agree, we should probably not even try this step i
|
+ << remote_address.ToString(); |
} |
- // Set only the IP address. |
- remote_address_.SetResolvedIP(jingle_socket_address.ipaddr()); |
} |
// SignalConnect after updating the |remote_address_| so that the listener |
@@ -599,11 +604,17 @@ void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address, |
DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
rtc::SocketAddress address_lj; |
- if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { |
- // We should always be able to convert address here because we |
- // don't expect IPv6 address on IPv4 connections. |
- NOTREACHED(); |
- return; |
+ |
+ if (address.address().empty()) { |
juberti2
2014/12/11 19:23:50
check that this only happens for TCP connections?
|
+ // |address| could be empty for TCP connections behind a proxy. |
+ address_lj = remote_address_; |
+ } else { |
+ if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { |
+ // We should always be able to convert address here because we |
+ // don't expect IPv6 address on IPv4 connections. |
+ NOTREACHED(); |
+ return; |
+ } |
} |
rtc::PacketTime packet_time(timestamp.ToInternalValue(), 0); |