diff --git a/src/async/core/AsyncTcpConnection.cpp b/src/async/core/AsyncTcpConnection.cpp index 655737b..8c78a8c 100644 --- a/src/async/core/AsyncTcpConnection.cpp +++ b/src/async/core/AsyncTcpConnection.cpp @@ -35,6 +35,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include +#include +#include #include #include #include @@ -378,6 +380,14 @@ std::string TcpConnection::sslCommonName(void) const void TcpConnection::setSocket(int sock) { this->sock = sock; + if (sock >= 0) + { + int on = 1; + if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&on, sizeof(on)) == -1) + { + perror("setsockopt(TcpConnection, TCP_NODELAY)"); + } + } rd_watch.setFd(sock, FdWatch::FD_WATCH_RD); rd_watch.setEnabled(sock >= 0); m_wr_watch.setEnabled(false);