Provide "hostname:port" to the P2P Browser process sockets via P2PHostMsg_CreateSocket.

Currently only hostname is given and it assumes IPEndPoint will have the port number. But
the assumption is wrong.

TBR=sergeyu@chromium.org

Review URL: https://codereview.chromium.org/378013002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281932 0039d316-1c4b-4281-b951-d872f2087c98
parent aa9cd670
...@@ -83,14 +83,16 @@ bool P2PSocketHostTcpBase::Init(const net::IPEndPoint& local_address, ...@@ -83,14 +83,16 @@ bool P2PSocketHostTcpBase::Init(const net::IPEndPoint& local_address,
remote_address_ = remote_address; remote_address_ = remote_address;
state_ = STATE_CONNECTING; state_ = STATE_CONNECTING;
net::HostPortPair dest_host_port_pair = net::HostPortPair dest_host_port_pair;
net::HostPortPair::FromIPEndPoint(remote_address.ip_address);
// If there is no resolved address, let's try with domain name, assuming // If there is no resolved address, let's try with domain name, assuming
// socket layer will do the DNS resolve. // socket layer will do the DNS resolve.
if (remote_address.ip_address.address().empty()) { if (remote_address.ip_address.address().empty()) {
DCHECK(!remote_address.hostname.empty()); DCHECK(!remote_address.hostname.empty());
dest_host_port_pair = net::HostPortPair( dest_host_port_pair = net::HostPortPair::FromString(
remote_address.hostname, remote_address.ip_address.port()); remote_address.hostname);
} else {
dest_host_port_pair = net::HostPortPair::FromIPEndPoint(
remote_address.ip_address);
} }
// TODO(mallinath) - We are ignoring local_address altogether. We should // TODO(mallinath) - We are ignoring local_address altogether. We should
......
...@@ -244,7 +244,9 @@ bool IpcPacketSocket::Init(P2PSocketType type, ...@@ -244,7 +244,9 @@ bool IpcPacketSocket::Init(P2PSocketType type,
// We need to send both resolved and unresolved address in Init. Unresolved // We need to send both resolved and unresolved address in Init. Unresolved
// address will be used in case of TLS for certificate hostname matching. // address will be used in case of TLS for certificate hostname matching.
// Certificate will be tied to domain name not to IP address. // Certificate will be tied to domain name not to IP address.
P2PHostAndIPEndPoint remote_info(remote_address.hostname(), remote_endpoint); std::string remote_hostname = remote_address.hostname() + ":" +
remote_address.PortAsString();
P2PHostAndIPEndPoint remote_info(remote_hostname, remote_endpoint);
client->Init(type, local_endpoint, remote_info, this); client->Init(type, local_endpoint, remote_info, this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment