Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: chrome/tools/service_discovery_sniffer/service_discovery_sniffer.cc

Issue 87693002: Refactored to make MDnsSocketFactory return array of sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <vector> 5 #include <vector>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 int main(int argc, char** argv) { 97 int main(int argc, char** argv) {
98 base::AtExitManager at_exit_manager; 98 base::AtExitManager at_exit_manager;
99 base::MessageLoopForIO message_loop; 99 base::MessageLoopForIO message_loop;
100 100
101 if (argc != 2) { 101 if (argc != 2) {
102 printf("Please provide exactly 1 argument.\n"); 102 printf("Please provide exactly 1 argument.\n");
103 return 1; 103 return 1;
104 } 104 }
105 105
106 scoped_ptr<net::MDnsClient> mdns_client = net::MDnsClient::CreateDefault(); 106 scoped_ptr<net::MDnsClient> mdns_client = net::MDnsClient::CreateDefault();
107 mdns_client->StartListening(); 107 scoped_ptr<net::MDnsSocketFactory> socket_factory =
108 net::MDnsSocketFactory::CreateDefault();
109 mdns_client->StartListening(socket_factory.get());
108 scoped_ptr<local_discovery::ServiceDiscoveryClient> service_discovery_client; 110 scoped_ptr<local_discovery::ServiceDiscoveryClient> service_discovery_client;
109 service_discovery_client.reset( 111 service_discovery_client.reset(
110 new local_discovery::ServiceDiscoveryClientImpl(mdns_client.get())); 112 new local_discovery::ServiceDiscoveryClientImpl(mdns_client.get()));
111 { 113 {
112 // To guarantee/make explicit the ordering constraint. 114 // To guarantee/make explicit the ordering constraint.
113 local_discovery::ServiceTypePrinter print_changes( 115 local_discovery::ServiceTypePrinter print_changes(
114 service_discovery_client.get(), 116 service_discovery_client.get(),
115 std::string(argv[1]) + "._tcp.local"); 117 std::string(argv[1]) + "._tcp.local");
116 118
117 print_changes.Start(); 119 print_changes.Start();
118 message_loop.Run(); 120 message_loop.Run();
119 } 121 }
120 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698