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

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

Issue 1728853006: net: merge two versions of SetTCPNoDelay() function into one (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: export it 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 0366b4d97a875cce68814f52ee148467eb75d75c..00f9b7e59e0ad68467d9c2d683e2ed592a4a57bc 100644
--- a/net/tools/flip_server/tcp_socket_util.cc
+++ b/net/tools/flip_server/tcp_socket_util.cc
@@ -17,6 +17,7 @@
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "net/socket/tcp_socket.h"
namespace net {
@@ -61,12 +62,6 @@ bool CloseSocket(int* fd, int tries) {
} // 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,
@@ -175,7 +170,7 @@ int CreateTCPServerSocket(const std::string& host,
}
if (disable_nagle) {
- if (!SetTCPNoDelay(sock)) {
+ if (!SetTCPNoDelay(sock, /*no_delay=*/true)) {
close(sock);
LOG(FATAL) << "SetTCPNoDelay() failed on fd: " << sock;
return -1;
@@ -253,7 +248,7 @@ int CreateTCPClientSocket(const std::string& host,
}
if (disable_nagle) {
- if (!SetTCPNoDelay(sock)) {
+ if (!SetTCPNoDelay(sock, /*no_delay=*/true)) {
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