| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/socket/tcp_socket.h" | |
| 6 | |
| 7 #include "build/build_config.h" | |
| 8 | |
| 9 #if defined(OS_POSIX) | |
| 10 #include <sys/socket.h> | |
| 11 #include <netinet/in.h> | |
| 12 #include <netinet/tcp.h> | |
| 13 #elif defined(OS_WIN) | |
| 14 #include <winsock2.h> | |
| 15 #endif | |
| 16 | |
| 17 namespace net { | |
| 18 | |
| 19 bool SetTCPNoDelay(SocketDescriptor socket, bool no_delay) { | |
| 20 #if defined(OS_POSIX) | |
| 21 int on = no_delay ? 1 : 0; | |
| 22 #elif defined(OS_WIN) | |
| 23 BOOL on = no_delay ? TRUE : FALSE; | |
| 24 #endif | |
| 25 return setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, | |
| 26 reinterpret_cast<const char*>(&on), sizeof(on)) == 0; | |
| 27 } | |
| 28 | |
| 29 } // namespace net | |
| OLD | NEW |