OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/socket/tcp_client_socket.h" | 5 #include "net/socket/tcp_client_socket.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <netdb.h> | 9 #include <netdb.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
11 #include <netinet/tcp.h> | 11 #include <netinet/tcp.h> |
12 #if defined(OS_POSIX) | 12 #if defined(OS_POSIX) |
13 #include <netinet/in.h> | 13 #include <netinet/in.h> |
14 #endif | 14 #endif |
15 | 15 |
16 #include "base/eintr_wrapper.h" | 16 #include "base/eintr_wrapper.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/metrics/stats_counters.h" | 19 #include "base/metrics/stats_counters.h" |
20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
21 #include "net/base/address_list_net_log_param.h" | 21 #include "net/base/address_list_net_log_param.h" |
22 #include "net/base/connection_type_histograms.h" | 22 #include "net/base/connection_type_histograms.h" |
23 #include "net/base/io_buffer.h" | 23 #include "net/base/io_buffer.h" |
24 #include "net/base/ip_endpoint.h" | 24 #include "net/base/ip_endpoint.h" |
25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
26 #include "net/base/net_log.h" | 26 #include "net/base/net_log.h" |
27 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
28 #include "net/base/network_change_notifier.h" | 28 #include "net/base/network_change_notifier.h" |
29 #if defined(USE_SYSTEM_LIBEVENT) | |
30 #include <event.h> | |
31 #else | |
32 #include "third_party/libevent/event.h" | |
33 #endif | |
34 | 29 |
35 namespace net { | 30 namespace net { |
36 | 31 |
37 namespace { | 32 namespace { |
38 | 33 |
39 const int kInvalidSocket = -1; | 34 const int kInvalidSocket = -1; |
40 | 35 |
41 // DisableNagle turns off buffering in the kernel. By default, TCP sockets will | 36 // DisableNagle turns off buffering in the kernel. By default, TCP sockets will |
42 // wait up to 200ms for more data to complete a packet before transmitting. | 37 // wait up to 200ms for more data to complete a packet before transmitting. |
43 // After calling this function, the kernel will not wait. See TCP_NODELAY in | 38 // After calling this function, the kernel will not wait. See TCP_NODELAY in |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 705 |
711 bool TCPClientSocketLibevent::WasEverUsed() const { | 706 bool TCPClientSocketLibevent::WasEverUsed() const { |
712 return use_history_.was_used_to_convey_data(); | 707 return use_history_.was_used_to_convey_data(); |
713 } | 708 } |
714 | 709 |
715 bool TCPClientSocketLibevent::UsingTCPFastOpen() const { | 710 bool TCPClientSocketLibevent::UsingTCPFastOpen() const { |
716 return use_tcp_fastopen_; | 711 return use_tcp_fastopen_; |
717 } | 712 } |
718 | 713 |
719 } // namespace net | 714 } // namespace net |
OLD | NEW |