OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/tools/quic/quic_client.h" | 5 #include "net/tools/quic/quic_client.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <netinet/in.h> | 8 #include <netinet/in.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 QuicClient::DummyPacketWriterFactory::~DummyPacketWriterFactory() {} | 115 QuicClient::DummyPacketWriterFactory::~DummyPacketWriterFactory() {} |
116 | 116 |
117 QuicPacketWriter* QuicClient::DummyPacketWriterFactory::Create( | 117 QuicPacketWriter* QuicClient::DummyPacketWriterFactory::Create( |
118 QuicConnection* /*connection*/) const { | 118 QuicConnection* /*connection*/) const { |
119 return writer_; | 119 return writer_; |
120 } | 120 } |
121 | 121 |
122 | 122 |
123 bool QuicClient::CreateUDPSocket() { | 123 bool QuicClient::CreateUDPSocket() { |
124 int address_family = server_address_.GetSockAddrFamily(); | 124 int address_family = server_address_.GetSockAddrFamily(); |
125 fd_ = QuicSocketUtils::CreateNonBlockingSocket(address_family, SOCK_DGRAM, | 125 fd_ = socket(address_family, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); |
126 IPPROTO_UDP); | |
127 if (fd_ < 0) { | 126 if (fd_ < 0) { |
128 return false; // failure already logged | 127 LOG(ERROR) << "CreateSocket() failed: " << strerror(errno); |
| 128 return false; |
129 } | 129 } |
130 | 130 |
131 int get_overflow = 1; | 131 int get_overflow = 1; |
132 int rc = setsockopt(fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow, | 132 int rc = setsockopt(fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow, |
133 sizeof(get_overflow)); | 133 sizeof(get_overflow)); |
134 if (rc < 0) { | 134 if (rc < 0) { |
135 DLOG(WARNING) << "Socket overflow detection not supported"; | 135 DLOG(WARNING) << "Socket overflow detection not supported"; |
136 } else { | 136 } else { |
137 overflow_supported_ = true; | 137 overflow_supported_ = true; |
138 } | 138 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 QuicEncryptedPacket packet(buf, bytes_read, false); | 402 QuicEncryptedPacket packet(buf, bytes_read, false); |
403 | 403 |
404 IPEndPoint client_address(client_ip, client_address_.port()); | 404 IPEndPoint client_address(client_ip, client_address_.port()); |
405 session_->connection()->ProcessUdpPacket( | 405 session_->connection()->ProcessUdpPacket( |
406 client_address, server_address, packet); | 406 client_address, server_address, packet); |
407 return true; | 407 return true; |
408 } | 408 } |
409 | 409 |
410 } // namespace tools | 410 } // namespace tools |
411 } // namespace net | 411 } // namespace net |
OLD | NEW |