Chromium Code Reviews| Index: net/socket/tcp_socket_posix.cc |
| diff --git a/net/socket/tcp_socket_posix.cc b/net/socket/tcp_socket_posix.cc |
| index 438d5aab41140a27ddf2cff6853c6253738a1be2..7ecdebd3bc39a95e155d7ba16563b0369877cdac 100644 |
| --- a/net/socket/tcp_socket_posix.cc |
| +++ b/net/socket/tcp_socket_posix.cc |
| @@ -14,6 +14,8 @@ |
| #include "base/logging.h" |
| #include "base/metrics/histogram_macros.h" |
| #include "base/posix/eintr_wrapper.h" |
| +#include "base/strings/string_number_conversions.h" |
| +#include "base/strings/string_piece.h" |
| #include "base/task_scheduler/post_task.h" |
| #include "base/time/time.h" |
| #include "net/base/address_list.h" |
| @@ -92,9 +94,12 @@ bool SystemSupportsTCPFastOpen() { |
| &system_supports_tcp_fastopen)) { |
| return false; |
| } |
| - // The read from /proc should return '1' if TCP FastOpen is enabled in the OS. |
| + // The read value from /proc will be set in its least significant bit if |
| + // TCP FastOpen is enabled. |
| + int read_int = 0; |
| if (system_supports_tcp_fastopen.empty() || |
| - (system_supports_tcp_fastopen[0] != '1')) { |
| + !StringToInt(StringPiece(system_supports_tcp_fastopen), &read_int) || |
|
Randy Smith (Not in Mondays)
2017/02/23 15:15:32
Are you comfortable with this failing if there's l
Jana
2017/02/24 19:24:44
I've added whitespace trimming, PTAL.
|
| + (read_int & 0x1) != 1) { |
| return false; |
| } |
| return true; |