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

Unified Diff: net/socket/tcp_socket_posix.cc

Issue 2705323002: Fix incorrect behavior in checking for TCP FastOpen platform support. (Closed)
Patch Set: Trim leading whitespace. 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..a37d83b5e724071fcb3e22f2bb8b990b94f34b4a 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"
@@ -23,6 +25,7 @@
#include "net/base/network_activity_monitor.h"
#include "net/base/network_change_notifier.h"
#include "net/base/sockaddr_storage.h"
+#include "net/http/http_util.h"
#include "net/log/net_log.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source.h"
@@ -92,12 +95,15 @@ bool SystemSupportsTCPFastOpen() {
&system_supports_tcp_fastopen)) {
return false;
}
- // The read from /proc should return '1' if TCP FastOpen is enabled in the OS.
- if (system_supports_tcp_fastopen.empty() ||
- (system_supports_tcp_fastopen[0] != '1')) {
- return false;
- }
- return true;
+ // The read value from /proc will be set in its least significant bit if
+ // TCP FastOpen is enabled.
+ int read_int = 0;
+ base::StringToInt(
+ HttpUtil::TrimLWS(base::StringPiece(system_supports_tcp_fastopen)),
+ &read_int);
+ if ((read_int & 0x1) == 1)
+ return true;
+ return false;
}
void RegisterTCPFastOpenIntentAndSupport(bool user_enabled,
« 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