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

Unified Diff: net/socket/tcp_client_socket.cc

Issue 23454010: POSIX only: Move client socket functionality from TCPClientSocket into TCPSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
Index: net/socket/tcp_client_socket.cc
diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc
index 294248466a5ae430e702186b998cc90334b4a5dc..12dc1b23c8ec24991bcadb7e41ffaec2d601016b 100644
--- a/net/socket/tcp_client_socket.cc
+++ b/net/socket/tcp_client_socket.cc
@@ -4,69 +4,13 @@
#include "net/socket/tcp_client_socket.h"
-#include "base/file_util.h"
-#include "base/files/file_path.h"
-
-#if defined(OS_WIN)
-
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
-#endif
-
namespace net {
-namespace {
-
-#if defined(OS_LINUX)
-
-// Checks to see if the system supports TCP FastOpen. Notably, it requires
-// kernel support. Additionally, this checks system configuration to ensure that
-// it's enabled.
-bool SystemSupportsTCPFastOpen() {
- static const base::FilePath::CharType kTCPFastOpenProcFilePath[] =
- "/proc/sys/net/ipv4/tcp_fastopen";
- std::string system_enabled_tcp_fastopen;
- if (!base::ReadFileToString(
- base::FilePath(kTCPFastOpenProcFilePath),
- &system_enabled_tcp_fastopen)) {
- return false;
- }
-
- // As per http://lxr.linux.no/linux+v3.7.7/include/net/tcp.h#L225
- // TFO_CLIENT_ENABLE is the LSB
- if (system_enabled_tcp_fastopen.empty() ||
- (system_enabled_tcp_fastopen[0] & 0x1) == 0) {
- return false;
- }
-
- return true;
-}
-
-#else
-
-bool SystemSupportsTCPFastOpen() {
- return false;
-}
-
-#endif
-
-}
-
-static bool g_tcp_fastopen_enabled = false;
-
-void SetTCPFastOpenEnabled(bool value) {
- g_tcp_fastopen_enabled = value && SystemSupportsTCPFastOpen();
-}
-
-bool IsTCPFastOpenEnabled() {
- return g_tcp_fastopen_enabled;
-}
-
-#if defined(OS_WIN)
-
TCPClientSocket::TCPClientSocket(const AddressList& addresses,
net::NetLog* net_log,
const net::NetLog::Source& source)
@@ -259,6 +203,10 @@ int TCPClientSocket::GetLocalAddress(IPEndPoint* address) const {
return socket_->GetLocalAddress(address);
}
+const BoundNetLog& TCPClientSocket::NetLog() const {
+ return socket_->net_log();
+}
+
void TCPClientSocket::SetSubresourceSpeculation() {
use_history_.set_subresource_speculation();
}
@@ -366,6 +314,4 @@ int TCPClientSocket::CreateSocket(AddressFamily family) {
return result;
}
-#endif
-
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698