Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: net/socket/tcp_socket_posix.cc

Issue 2705323002: Fix incorrect behavior in checking for TCP FastOpen platform support. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698