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_LIBEVENT_H_ | 5 #ifndef NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ |
6 #define NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ | 6 #define NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // - SetKeepAlive(true, 45). | 58 // - SetKeepAlive(true, 45). |
59 void SetDefaultOptionsForClient(); | 59 void SetDefaultOptionsForClient(); |
60 int SetAddressReuse(bool allow); | 60 int SetAddressReuse(bool allow); |
61 int SetReceiveBufferSize(int32 size); | 61 int SetReceiveBufferSize(int32 size); |
62 int SetSendBufferSize(int32 size); | 62 int SetSendBufferSize(int32 size); |
63 bool SetKeepAlive(bool enable, int delay); | 63 bool SetKeepAlive(bool enable, int delay); |
64 bool SetNoDelay(bool no_delay); | 64 bool SetNoDelay(bool no_delay); |
65 | 65 |
66 void Close(); | 66 void Close(); |
67 | 67 |
| 68 // Setter/Getter methods for TCP FastOpen socket option. |
68 bool UsingTCPFastOpen() const; | 69 bool UsingTCPFastOpen() const; |
| 70 void EnableTCPFastOpenIfSupported(); |
| 71 |
69 bool IsValid() const; | 72 bool IsValid() const; |
70 | 73 |
71 // Marks the start/end of a series of connect attempts for logging purpose. | 74 // Marks the start/end of a series of connect attempts for logging purpose. |
72 // | 75 // |
73 // TCPClientSocket may attempt to connect to multiple addresses until it | 76 // TCPClientSocket may attempt to connect to multiple addresses until it |
74 // succeeds in establishing a connection. The corresponding log will have | 77 // succeeds in establishing a connection. The corresponding log will have |
75 // multiple NetLog::TYPE_TCP_CONNECT_ATTEMPT entries nested within a | 78 // multiple NetLog::TYPE_TCP_CONNECT_ATTEMPT entries nested within a |
76 // NetLog::TYPE_TCP_CONNECT. These methods set the start/end of | 79 // NetLog::TYPE_TCP_CONNECT. These methods set the start/end of |
77 // NetLog::TYPE_TCP_CONNECT. | 80 // NetLog::TYPE_TCP_CONNECT. |
78 // | 81 // |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 int buf_len, | 164 int buf_len, |
162 const CompletionCallback& callback); | 165 const CompletionCallback& callback); |
163 | 166 |
164 // Called when the socket is known to be in a connected state. | 167 // Called when the socket is known to be in a connected state. |
165 void RecordFastOpenStatus(); | 168 void RecordFastOpenStatus(); |
166 | 169 |
167 scoped_ptr<SocketLibevent> socket_; | 170 scoped_ptr<SocketLibevent> socket_; |
168 scoped_ptr<SocketLibevent> accept_socket_; | 171 scoped_ptr<SocketLibevent> accept_socket_; |
169 | 172 |
170 // Enables experimental TCP FastOpen option. | 173 // Enables experimental TCP FastOpen option. |
171 const bool use_tcp_fastopen_; | 174 bool use_tcp_fastopen_; |
172 | 175 |
173 // True when TCP FastOpen is in use and we have done the connect. | 176 // True when TCP FastOpen is in use and we have done the connect. |
174 bool tcp_fastopen_connected_; | 177 bool tcp_fastopen_connected_; |
175 | |
176 FastOpenStatus fast_open_status_; | 178 FastOpenStatus fast_open_status_; |
177 | 179 |
178 bool logging_multiple_connect_attempts_; | 180 bool logging_multiple_connect_attempts_; |
179 | 181 |
180 BoundNetLog net_log_; | 182 BoundNetLog net_log_; |
181 | 183 |
182 DISALLOW_COPY_AND_ASSIGN(TCPSocketLibevent); | 184 DISALLOW_COPY_AND_ASSIGN(TCPSocketLibevent); |
183 }; | 185 }; |
184 | 186 |
185 } // namespace net | 187 } // namespace net |
186 | 188 |
187 #endif // NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ | 189 #endif // NET_SOCKET_TCP_SOCKET_LIBEVENT_H_ |
OLD | NEW |