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

Unified Diff: net/tools/flip_server/tcp_socket_util.cc

Issue 1744153003: Revert of net: merge two versions of SetTCPNoDelay() function into one (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « net/tools/flip_server/tcp_socket_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/flip_server/tcp_socket_util.cc
diff --git a/net/tools/flip_server/tcp_socket_util.cc b/net/tools/flip_server/tcp_socket_util.cc
index 00f9b7e59e0ad68467d9c2d683e2ed592a4a57bc..0366b4d97a875cce68814f52ee148467eb75d75c 100644
--- a/net/tools/flip_server/tcp_socket_util.cc
+++ b/net/tools/flip_server/tcp_socket_util.cc
@@ -17,7 +17,6 @@
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "net/socket/tcp_socket.h"
namespace net {
@@ -62,6 +61,12 @@
} // namespace
+bool SetTCPNoDelay(int fd) {
+ int on = 1;
+ return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&on),
+ sizeof(on)) == 0;
+}
+
int CreateTCPServerSocket(const std::string& host,
const std::string& port,
bool is_numeric_host_address,
@@ -170,7 +175,7 @@
}
if (disable_nagle) {
- if (!SetTCPNoDelay(sock, /*no_delay=*/true)) {
+ if (!SetTCPNoDelay(sock)) {
close(sock);
LOG(FATAL) << "SetTCPNoDelay() failed on fd: " << sock;
return -1;
@@ -248,7 +253,7 @@
}
if (disable_nagle) {
- if (!SetTCPNoDelay(sock, /*no_delay=*/true)) {
+ if (!SetTCPNoDelay(sock)) {
close(sock);
LOG(FATAL) << "SetTCPNoDelay() failed on fd: " << sock;
return -1;
« no previous file with comments | « net/tools/flip_server/tcp_socket_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698