mirror of https://github.com/aria2/aria2
Disable TCP_NODELAY for BitTorrent
To make Request messages more often packed into 1 packet.pull/43/head
parent
e6b0274685
commit
bf4ea63a66
|
@ -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(),
|
||||
|
|
|
@ -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> 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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -73,7 +73,7 @@ bool HttpListenCommand::execute()
|
|||
try {
|
||||
if(serverSocket_->isReadable(0)) {
|
||||
SharedHandle<SocketCore> socket(serverSocket_->acceptConnection());
|
||||
|
||||
socket->setTcpNodelay(true);
|
||||
std::pair<std::string, uint16_t> peerInfo;
|
||||
socket->getPeerInfo(peerInfo);
|
||||
|
||||
|
|
|
@ -369,7 +369,6 @@ SharedHandle<SocketCore> SocketCore::acceptConnection() const
|
|||
}
|
||||
SharedHandle<SocketCore> 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;
|
||||
|
|
Loading…
Reference in New Issue