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

Unified Diff: net/tools/quic/quic_server.cc

Issue 1752823002: n/a (QUIC toy client/server changes) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@115400573
Patch Set: Revert to Patch Set 1 Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_bin.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_server.cc
diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc
index 8af7eba3f6d5f1c375b2cee20daf525a96e7b31d..9b14424556368d27549c8a5a121804f43113c29f 100644
--- a/net/tools/quic/quic_server.cc
+++ b/net/tools/quic/quic_server.cc
@@ -107,51 +107,18 @@ void QuicServer::Initialize() {
QuicServer::~QuicServer() {}
-bool QuicServer::Listen(const IPEndPoint& address) {
- port_ = address.port();
- int address_family = address.GetSockAddrFamily();
- fd_ = socket(address_family, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
+bool QuicServer::CreateUDPSocketAndListen(const IPEndPoint& address) {
+ fd_ = QuicSocketUtils::CreateUDPSocket(address, &overflow_supported_);
if (fd_ < 0) {
LOG(ERROR) << "CreateSocket() failed: " << strerror(errno);
return false;
}
- // Enable the socket option that allows the local address to be
- // returned if the socket is bound to more than one address.
- int rc = QuicSocketUtils::SetGetAddressInfo(fd_, address_family);
-
- if (rc < 0) {
- LOG(ERROR) << "IP detection not supported" << strerror(errno);
- return false;
- }
-
- int get_overflow = 1;
- rc = setsockopt(fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow,
- sizeof(get_overflow));
-
- if (rc < 0) {
- DLOG(WARNING) << "Socket overflow detection not supported";
- } else {
- overflow_supported_ = true;
- }
-
- // These send and receive buffer sizes are sized for a single connection,
- // because the default usage of QuicServer is as a test server with one or
- // two clients. Adjust higher for use with many clients.
- if (!QuicSocketUtils::SetReceiveBufferSize(fd_,
- kDefaultSocketReceiveBuffer)) {
- return false;
- }
-
- if (!QuicSocketUtils::SetSendBufferSize(fd_, kDefaultSocketReceiveBuffer)) {
- return false;
- }
-
sockaddr_storage raw_addr;
socklen_t raw_addr_len = sizeof(raw_addr);
CHECK(address.ToSockAddr(reinterpret_cast<sockaddr*>(&raw_addr),
&raw_addr_len));
- rc =
+ int rc =
bind(fd_, reinterpret_cast<const sockaddr*>(&raw_addr), sizeof(raw_addr));
if (rc < 0) {
LOG(ERROR) << "Bind failed: " << strerror(errno);
« no previous file with comments | « net/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698