diff options
author | hidehiko <hidehiko@chromium.org> | 2014-12-07 22:02:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-08 06:02:37 +0000 |
commit | 17fac55b85211ba10c1bb3bf8a46798bcf0eb729 (patch) | |
tree | 2076d17250ea9208ddeaaf33b705bfdc60fd760b /cloud_print/gcp20 | |
parent | cdbebd0c9cb856751ce1eb44091fcd4f84018613 (diff) | |
download | chromium_src-17fac55b85211ba10c1bb3bf8a46798bcf0eb729.zip chromium_src-17fac55b85211ba10c1bb3bf8a46798bcf0eb729.tar.gz chromium_src-17fac55b85211ba10c1bb3bf8a46798bcf0eb729.tar.bz2 |
Remove timing limitation to set Broadcast, ReceiveBuffer, and SendBuffer options from UDPSocket.
Currently, we have timing limitation to set these options.
This CL splits Open() from Connect() and Bind(), so that those options can be set anytime after Open().
This is the preparation to remove the same limitation from PPAPI's socket APIs.
BUG=425563, 420697
TEST=Ran trybots.
Review URL: https://codereview.chromium.org/721273002
Cr-Commit-Position: refs/heads/master@{#307204}
Diffstat (limited to 'cloud_print/gcp20')
-rw-r--r-- | cloud_print/gcp20/prototype/dns_sd_server.cc | 9 | ||||
-rw-r--r-- | cloud_print/gcp20/prototype/dns_sd_server.h | 5 |
2 files changed, 4 insertions, 10 deletions
diff --git a/cloud_print/gcp20/prototype/dns_sd_server.cc b/cloud_print/gcp20/prototype/dns_sd_server.cc index a43f9f0..78d9812 100644 --- a/cloud_print/gcp20/prototype/dns_sd_server.cc +++ b/cloud_print/gcp20/prototype/dns_sd_server.cc @@ -123,9 +123,7 @@ bool DnsSdServer::CreateSocket() { DCHECK(success); - socket_.reset(new net::UDPSocket(net::DatagramSocket::DEFAULT_BIND, - net::RandIntCallback(), NULL, - net::NetLog::Source())); + socket_.reset(new net::UDPServerSocket(NULL, net::NetLog::Source())); net::IPEndPoint local_address = net::IPEndPoint(local_ip_any, kDefaultPortMulticast); @@ -134,7 +132,7 @@ bool DnsSdServer::CreateSocket() { socket_->AllowAddressReuse(); - int status = socket_->Bind(local_address); + int status = socket_->Listen(local_address); if (status < 0) return false; @@ -143,9 +141,6 @@ bool DnsSdServer::CreateSocket() { if (status < 0) return false; - - DCHECK(socket_->is_connected()); - return true; } diff --git a/cloud_print/gcp20/prototype/dns_sd_server.h b/cloud_print/gcp20/prototype/dns_sd_server.h index f9aa540..dc8683f 100644 --- a/cloud_print/gcp20/prototype/dns_sd_server.h +++ b/cloud_print/gcp20/prototype/dns_sd_server.h @@ -13,7 +13,7 @@ #include "base/memory/weak_ptr.h" #include "cloud_print/gcp20/prototype/service_parameters.h" #include "net/base/ip_endpoint.h" -#include "net/udp/udp_socket.h" +#include "net/udp/udp_server_socket.h" namespace net { @@ -79,7 +79,7 @@ class DnsSdServer : public base::SupportsWeakPtr<DnsSdServer> { uint32 GetCurrentTLL() const; // Stores socket to multicast address. - scoped_ptr<net::UDPSocket> socket_; + scoped_ptr<net::UDPServerSocket> socket_; // Stores multicast address end point. net::IPEndPoint multicast_address_; @@ -106,4 +106,3 @@ class DnsSdServer : public base::SupportsWeakPtr<DnsSdServer> { }; #endif // CLOUD_PRINT_GCP20_PROTOTYPE_DNS_SD_SERVER_H_ - |