Enabled TCP_NODELAY in SocketCore::establishConnection and acceptConnection

pull/36/head
Tatsuhiro Tsujikawa 2012-11-28 00:20:43 +09:00
parent e781e6eac1
commit 16e25ef4e1
2 changed files with 2 additions and 1 deletions

View File

@ -220,7 +220,6 @@ bool HttpServerCommand::execute()
httpServer_->feedUpgradeResponse("websocket",
fmt("Sec-WebSocket-Accept: %s\r\n",
serverKey.c_str()));
httpServer_->getSocket()->setTcpNodelay(true);
command = new rpc::WebSocketResponseCommand(getCuid(), httpServer_,
e_, socket_);
} else {

View File

@ -369,6 +369,7 @@ SharedHandle<SocketCore> SocketCore::acceptConnection() const
}
SharedHandle<SocketCore> sock(new SocketCore(fd, sockType_));
sock->setNonBlockingMode();
sock->setTcpNodelay(true);
return sock;
}
@ -461,6 +462,7 @@ 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;