| Index: content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| index eaf7beb1293b08b65a45e619d51dc47eaf5e6793..c8d73e9ae9a9b0537f5aa07477403010ed3cac03 100644
|
| --- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| +++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
|
| @@ -25,10 +25,9 @@ class P2PSocketDispatcherHost::DnsRequest {
|
| public:
|
| typedef base::Callback<void(const net::IPAddressNumber&)> DoneCallback;
|
|
|
| - DnsRequest(int32 routing_id, int32 request_id,
|
| + DnsRequest(int32 request_id,
|
| net::HostResolver* host_resolver)
|
| - : routing_id_(routing_id),
|
| - request_id_(request_id),
|
| + : request_id_(request_id),
|
| resolver_(host_resolver) {
|
| }
|
|
|
| @@ -60,7 +59,6 @@ class P2PSocketDispatcherHost::DnsRequest {
|
| OnDone(result);
|
| }
|
|
|
| - int32 routing_id() { return routing_id_; }
|
| int32 request_id() { return request_id_; }
|
|
|
| private:
|
| @@ -83,7 +81,6 @@ class P2PSocketDispatcherHost::DnsRequest {
|
| done_callback_.Run(addresses_.front().address());
|
| }
|
|
|
| - int32 routing_id_;
|
| int32 request_id_;
|
| net::AddressList addresses_;
|
|
|
| @@ -165,8 +162,6 @@ void P2PSocketDispatcherHost::OnStartNetworkNotifications(
|
| monitoring_networks_ = true;
|
| }
|
|
|
| - notifications_routing_ids_.insert(msg.routing_id());
|
| -
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE, FROM_HERE, base::Bind(
|
| &P2PSocketDispatcherHost::DoGetNetworkList, this));
|
| @@ -174,14 +169,17 @@ void P2PSocketDispatcherHost::OnStartNetworkNotifications(
|
|
|
| void P2PSocketDispatcherHost::OnStopNetworkNotifications(
|
| const IPC::Message& msg) {
|
| - notifications_routing_ids_.erase(msg.routing_id());
|
| + if (monitoring_networks_) {
|
| + net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
|
| + monitoring_networks_ = false;
|
| + }
|
| }
|
|
|
| void P2PSocketDispatcherHost::OnGetHostAddress(const IPC::Message& msg,
|
| const std::string& host_name,
|
| int32 request_id) {
|
| - DnsRequest* request = new DnsRequest(
|
| - msg.routing_id(), request_id, resource_context_->GetHostResolver());
|
| + DnsRequest* request = new DnsRequest(request_id,
|
| + resource_context_->GetHostResolver());
|
| dns_requests_.insert(request);
|
| request->Resolve(host_name, base::Bind(
|
| &P2PSocketDispatcherHost::OnAddressResolved,
|
| @@ -199,10 +197,10 @@ void P2PSocketDispatcherHost::OnCreateSocket(
|
| }
|
|
|
| scoped_ptr<P2PSocketHost> socket(
|
| - P2PSocketHost::Create(this, msg.routing_id(), socket_id, type));
|
| + P2PSocketHost::Create(this, socket_id, type));
|
|
|
| if (!socket.get()) {
|
| - Send(new P2PMsg_OnError(msg.routing_id(), socket_id));
|
| + Send(new P2PMsg_OnError(socket_id));
|
| return;
|
| }
|
|
|
| @@ -263,17 +261,13 @@ void P2PSocketDispatcherHost::DoGetNetworkList() {
|
|
|
| void P2PSocketDispatcherHost::SendNetworkList(
|
| const net::NetworkInterfaceList& list) {
|
| - for (std::set<int>::iterator it = notifications_routing_ids_.begin();
|
| - it != notifications_routing_ids_.end(); ++it) {
|
| - Send(new P2PMsg_NetworkListChanged(*it, list));
|
| - }
|
| + Send(new P2PMsg_NetworkListChanged(list));
|
| }
|
|
|
| void P2PSocketDispatcherHost::OnAddressResolved(
|
| DnsRequest* request,
|
| const net::IPAddressNumber& result) {
|
| - Send(new P2PMsg_GetHostAddressResult(
|
| - request->routing_id(), request->request_id(), result));
|
| + Send(new P2PMsg_GetHostAddressResult(request->request_id(), result));
|
|
|
| dns_requests_.erase(request);
|
| delete request;
|
|
|