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/epoll.h> | 10 #include <sys/epoll.h> |
11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 | 13 |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "net/quic/congestion_control/tcp_receiver.h" | |
16 #include "net/quic/crypto/quic_random.h" | 15 #include "net/quic/crypto/quic_random.h" |
17 #include "net/quic/quic_connection.h" | 16 #include "net/quic/quic_connection.h" |
18 #include "net/quic/quic_data_reader.h" | 17 #include "net/quic/quic_data_reader.h" |
19 #include "net/quic/quic_protocol.h" | 18 #include "net/quic/quic_protocol.h" |
20 #include "net/quic/quic_server_id.h" | 19 #include "net/quic/quic_server_id.h" |
21 #include "net/tools/balsa/balsa_headers.h" | 20 #include "net/tools/balsa/balsa_headers.h" |
22 #include "net/tools/epoll_server/epoll_server.h" | 21 #include "net/tools/epoll_server/epoll_server.h" |
23 #include "net/tools/quic/quic_epoll_connection_helper.h" | 22 #include "net/tools/quic/quic_epoll_connection_helper.h" |
24 #include "net/tools/quic/quic_socket_utils.h" | 23 #include "net/tools/quic/quic_socket_utils.h" |
25 #include "net/tools/quic/quic_spdy_client_stream.h" | 24 #include "net/tools/quic/quic_spdy_client_stream.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 int get_overflow = 1; | 130 int get_overflow = 1; |
132 int rc = setsockopt(fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow, | 131 int rc = setsockopt(fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow, |
133 sizeof(get_overflow)); | 132 sizeof(get_overflow)); |
134 if (rc < 0) { | 133 if (rc < 0) { |
135 DLOG(WARNING) << "Socket overflow detection not supported"; | 134 DLOG(WARNING) << "Socket overflow detection not supported"; |
136 } else { | 135 } else { |
137 overflow_supported_ = true; | 136 overflow_supported_ = true; |
138 } | 137 } |
139 | 138 |
140 if (!QuicSocketUtils::SetReceiveBufferSize(fd_, | 139 if (!QuicSocketUtils::SetReceiveBufferSize(fd_, |
141 TcpReceiver::kReceiveWindowTCP)) { | 140 kDefaultSocketReceiveBuffer)) { |
142 return false; | 141 return false; |
143 } | 142 } |
144 | 143 |
145 if (!QuicSocketUtils::SetSendBufferSize(fd_, | 144 if (!QuicSocketUtils::SetSendBufferSize(fd_, kDefaultSocketReceiveBuffer)) { |
146 TcpReceiver::kReceiveWindowTCP)) { | |
147 return false; | 145 return false; |
148 } | 146 } |
149 | 147 |
150 rc = QuicSocketUtils::SetGetAddressInfo(fd_, address_family); | 148 rc = QuicSocketUtils::SetGetAddressInfo(fd_, address_family); |
151 if (rc < 0) { | 149 if (rc < 0) { |
152 LOG(ERROR) << "IP detection not supported" << strerror(errno); | 150 LOG(ERROR) << "IP detection not supported" << strerror(errno); |
153 return false; | 151 return false; |
154 } | 152 } |
155 | 153 |
156 if (bind_to_address_.size() != 0) { | 154 if (bind_to_address_.size() != 0) { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 QuicEncryptedPacket packet(buf, bytes_read, false); | 401 QuicEncryptedPacket packet(buf, bytes_read, false); |
404 | 402 |
405 IPEndPoint client_address(client_ip, client_address_.port()); | 403 IPEndPoint client_address(client_ip, client_address_.port()); |
406 session_->connection()->ProcessUdpPacket( | 404 session_->connection()->ProcessUdpPacket( |
407 client_address, server_address, packet); | 405 client_address, server_address, packet); |
408 return true; | 406 return true; |
409 } | 407 } |
410 | 408 |
411 } // namespace tools | 409 } // namespace tools |
412 } // namespace net | 410 } // namespace net |
OLD | NEW |