OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef NET_SOCKET_TCP_SOCKET_H_ | 5 #ifndef NET_SOCKET_TCP_SOCKET_H_ |
6 #define NET_SOCKET_TCP_SOCKET_H_ | 6 #define NET_SOCKET_TCP_SOCKET_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include "net/socket/tcp_socket_win.h" | 12 #include "net/socket/tcp_socket_win.h" |
13 #elif defined(OS_POSIX) | 13 #elif defined(OS_POSIX) |
14 #include "net/socket/tcp_socket_libevent.h" | 14 #include "net/socket/tcp_socket_libevent.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 // Enable/disable experimental TCP FastOpen option. | 19 // Check if TCP FastOpen option is supported by the OS. |
20 bool IsTCPFastOpenSupported(); | |
21 | |
22 // Check if TCP FastOpen option is enabled. | |
23 bool IsTCPFastOpenEnabled(); | |
24 | |
25 // Checks if TCP FastOpen is supported by the kernel. Also enables TFO for all | |
26 // connections if indicated by user. | |
20 // Not thread safe. Must be called during initialization/startup only. | 27 // Not thread safe. Must be called during initialization/startup only. |
21 NET_EXPORT void SetTCPFastOpenEnabled(bool value); | 28 NET_EXPORT void CheckSupportAndMaybeEnableTCPFastOpen(bool user_enabled_tfo); |
mmenke
2014/08/12 15:25:15
Per earlier comment, "tfo" isn't a standard abbrev
mmenke
2014/08/12 15:25:15
Calling this with false does not indicate to me "E
Jana
2014/08/13 07:33:40
Changed, PTAL. The initial intent was to indicate
Jana
2014/08/13 07:33:40
Done.
| |
22 | |
23 // Check if the TCP FastOpen option is enabled. | |
24 bool IsTCPFastOpenEnabled(); | |
25 | 29 |
26 // TCPSocket provides a platform-independent interface for TCP sockets. | 30 // TCPSocket provides a platform-independent interface for TCP sockets. |
27 // | 31 // |
28 // It is recommended to use TCPClientSocket/TCPServerSocket instead of this | 32 // It is recommended to use TCPClientSocket/TCPServerSocket instead of this |
29 // class, unless a clear separation of client and server socket functionality is | 33 // class, unless a clear separation of client and server socket functionality is |
30 // not suitable for your use case (e.g., a socket needs to be created and bound | 34 // not suitable for your use case (e.g., a socket needs to be created and bound |
31 // before you know whether it is a client or server socket). | 35 // before you know whether it is a client or server socket). |
32 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
33 typedef TCPSocketWin TCPSocket; | 37 typedef TCPSocketWin TCPSocket; |
34 #elif defined(OS_POSIX) | 38 #elif defined(OS_POSIX) |
35 typedef TCPSocketLibevent TCPSocket; | 39 typedef TCPSocketLibevent TCPSocket; |
36 #endif | 40 #endif |
37 | 41 |
38 } // namespace net | 42 } // namespace net |
39 | 43 |
40 #endif // NET_SOCKET_TCP_SOCKET_H_ | 44 #endif // NET_SOCKET_TCP_SOCKET_H_ |
OLD | NEW |