diff --git a/src/FtpInitiateConnectionCommand.cc b/src/FtpInitiateConnectionCommand.cc index 374bfccb..5558e712 100644 --- a/src/FtpInitiateConnectionCommand.cc +++ b/src/FtpInitiateConnectionCommand.cc @@ -95,6 +95,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand getCuid(), addr.c_str(), port)); createSocket(); getSocket()->establishConnection(addr, port); + getSocket()->setTcpNodelay(true); getRequest()->setConnectedAddrInfo(hostname, addr, port); if(proxyMethod == V_GET) { @@ -163,6 +164,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand getCuid(), addr.c_str(), port)); createSocket(); getSocket()->establishConnection(addr, port); + getSocket()->setTcpNodelay(true); FtpNegotiationCommand* c = new FtpNegotiationCommand(getCuid(), getRequest(), getFileEntry(), getRequestGroup(), getDownloadEngine(), diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 6da4dc27..a5c804b9 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -683,6 +683,7 @@ bool FtpNegotiationCommand::preparePasvConnect() { pasvPort_)); dataSocket_.reset(new SocketCore()); dataSocket_->establishConnection(dataAddr.first, pasvPort_); + dataSocket_->setTcpNodelay(true); disableReadCheckSocket(); setWriteCheckSocket(dataSocket_); sequence_ = SEQ_SEND_REST_PASV; @@ -704,6 +705,7 @@ bool FtpNegotiationCommand::resolveProxy() proxyAddr_.c_str(), proxyReq->getPort())); dataSocket_.reset(new SocketCore()); dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort()); + dataSocket_->setTcpNodelay(true); disableReadCheckSocket(); setWriteCheckSocket(dataSocket_); SharedHandle socketRecvBuffer @@ -739,6 +741,7 @@ bool FtpNegotiationCommand::sendTunnelRequest() getCuid(), proxyAddr_.c_str(), proxyReq->getPort())); dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort()); + dataSocket_->setTcpNodelay(true); return false; } } @@ -867,6 +870,7 @@ bool FtpNegotiationCommand::waitConnection() disableReadCheckSocket(); setReadCheckSocket(getSocket()); dataSocket_ = serverSocket_->acceptConnection(); + dataSocket_->setTcpNodelay(true); sequence_ = SEQ_NEGOTIATION_COMPLETED; return false; } diff --git a/src/HttpInitiateConnectionCommand.cc b/src/HttpInitiateConnectionCommand.cc index 418aac15..3012467f 100644 --- a/src/HttpInitiateConnectionCommand.cc +++ b/src/HttpInitiateConnectionCommand.cc @@ -82,6 +82,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand getCuid(), addr.c_str(), port)); createSocket(); getSocket()->establishConnection(addr, port); + getSocket()->setTcpNodelay(true); getRequest()->setConnectedAddrInfo(hostname, addr, port); if(proxyMethod == V_TUNNEL) { @@ -139,6 +140,8 @@ Command* HttpInitiateConnectionCommand::createNextCommand getCuid(), addr.c_str(), port)); createSocket(); getSocket()->establishConnection(addr, port); + getSocket()->setTcpNodelay(true); + getRequest()->setConnectedAddrInfo(hostname, addr, port); } else { setSocket(pooledSocket); diff --git a/src/HttpListenCommand.cc b/src/HttpListenCommand.cc index 6ee061d3..a6accbfd 100644 --- a/src/HttpListenCommand.cc +++ b/src/HttpListenCommand.cc @@ -73,7 +73,7 @@ bool HttpListenCommand::execute() try { if(serverSocket_->isReadable(0)) { SharedHandle socket(serverSocket_->acceptConnection()); - + socket->setTcpNodelay(true); std::pair peerInfo; socket->getPeerInfo(peerInfo); diff --git a/src/SocketCore.cc b/src/SocketCore.cc index e18ed912..55c97d08 100644 --- a/src/SocketCore.cc +++ b/src/SocketCore.cc @@ -369,7 +369,6 @@ SharedHandle SocketCore::acceptConnection() const } SharedHandle sock(new SocketCore(fd, sockType_)); sock->setNonBlockingMode(); - sock->setTcpNodelay(true); return sock; } @@ -462,7 +461,6 @@ void SocketCore::establishConnection(const std::string& host, uint16_t port) sockfd_ = fd; // make socket non-blocking mode setNonBlockingMode(); - setTcpNodelay(true); if(connect(fd, rp->ai_addr, rp->ai_addrlen) == -1 && SOCKET_ERRNO != A2_EINPROGRESS) { errNum = SOCKET_ERRNO;