Skip to content

Commit

Permalink
disable tcp_cork on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Nov 16, 2020
1 parent b7934ec commit 661b789
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/swoole_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,12 @@ struct Socket {
if (tcp_nopush) {
return false;
}
#ifdef TCP_CORK
if (set_tcp_nopush(1) < 0) {
swSysWarn("set_tcp_nopush(fd=%d, ON) failed", fd);
return false;
}
#endif
// Need to turn off tcp nodelay when using nopush
if (tcp_nodelay && set_tcp_nodelay(0) != 0) {
swSysWarn("set_tcp_nodelay(fd=%d, OFF) failed", fd);
Expand All @@ -344,10 +346,12 @@ struct Socket {
if (!tcp_nopush) {
return false;
}
#ifdef TCP_CORK
if (set_tcp_nopush(0) < 0) {
swSysWarn("set_tcp_nopush(fd=%d, OFF) failed", fd);
return false;
}
#endif
// Restore tcp_nodelay setting
if (enable_tcp_nodelay && tcp_nodelay == 0 && set_tcp_nodelay(1) != 0) {
swSysWarn("set_tcp_nodelay(fd=%d, ON) failed", fd);
Expand Down

0 comments on commit 661b789

Please sign in to comment.