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));
|
getCuid(), addr.c_str(), port));
|
||||||
createSocket();
|
createSocket();
|
||||||
getSocket()->establishConnection(addr, port);
|
getSocket()->establishConnection(addr, port);
|
||||||
|
getSocket()->setTcpNodelay(true);
|
||||||
|
|
||||||
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
||||||
if(proxyMethod == V_GET) {
|
if(proxyMethod == V_GET) {
|
||||||
|
@ -163,6 +164,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
||||||
getCuid(), addr.c_str(), port));
|
getCuid(), addr.c_str(), port));
|
||||||
createSocket();
|
createSocket();
|
||||||
getSocket()->establishConnection(addr, port);
|
getSocket()->establishConnection(addr, port);
|
||||||
|
getSocket()->setTcpNodelay(true);
|
||||||
FtpNegotiationCommand* c =
|
FtpNegotiationCommand* c =
|
||||||
new FtpNegotiationCommand(getCuid(), getRequest(), getFileEntry(),
|
new FtpNegotiationCommand(getCuid(), getRequest(), getFileEntry(),
|
||||||
getRequestGroup(), getDownloadEngine(),
|
getRequestGroup(), getDownloadEngine(),
|
||||||
|
|
|
@ -683,6 +683,7 @@ bool FtpNegotiationCommand::preparePasvConnect() {
|
||||||
pasvPort_));
|
pasvPort_));
|
||||||
dataSocket_.reset(new SocketCore());
|
dataSocket_.reset(new SocketCore());
|
||||||
dataSocket_->establishConnection(dataAddr.first, pasvPort_);
|
dataSocket_->establishConnection(dataAddr.first, pasvPort_);
|
||||||
|
dataSocket_->setTcpNodelay(true);
|
||||||
disableReadCheckSocket();
|
disableReadCheckSocket();
|
||||||
setWriteCheckSocket(dataSocket_);
|
setWriteCheckSocket(dataSocket_);
|
||||||
sequence_ = SEQ_SEND_REST_PASV;
|
sequence_ = SEQ_SEND_REST_PASV;
|
||||||
|
@ -704,6 +705,7 @@ bool FtpNegotiationCommand::resolveProxy()
|
||||||
proxyAddr_.c_str(), proxyReq->getPort()));
|
proxyAddr_.c_str(), proxyReq->getPort()));
|
||||||
dataSocket_.reset(new SocketCore());
|
dataSocket_.reset(new SocketCore());
|
||||||
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
|
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
|
||||||
|
dataSocket_->setTcpNodelay(true);
|
||||||
disableReadCheckSocket();
|
disableReadCheckSocket();
|
||||||
setWriteCheckSocket(dataSocket_);
|
setWriteCheckSocket(dataSocket_);
|
||||||
SharedHandle<SocketRecvBuffer> socketRecvBuffer
|
SharedHandle<SocketRecvBuffer> socketRecvBuffer
|
||||||
|
@ -739,6 +741,7 @@ bool FtpNegotiationCommand::sendTunnelRequest()
|
||||||
getCuid(),
|
getCuid(),
|
||||||
proxyAddr_.c_str(), proxyReq->getPort()));
|
proxyAddr_.c_str(), proxyReq->getPort()));
|
||||||
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
|
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
|
||||||
|
dataSocket_->setTcpNodelay(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -867,6 +870,7 @@ bool FtpNegotiationCommand::waitConnection()
|
||||||
disableReadCheckSocket();
|
disableReadCheckSocket();
|
||||||
setReadCheckSocket(getSocket());
|
setReadCheckSocket(getSocket());
|
||||||
dataSocket_ = serverSocket_->acceptConnection();
|
dataSocket_ = serverSocket_->acceptConnection();
|
||||||
|
dataSocket_->setTcpNodelay(true);
|
||||||
sequence_ = SEQ_NEGOTIATION_COMPLETED;
|
sequence_ = SEQ_NEGOTIATION_COMPLETED;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand
|
||||||
getCuid(), addr.c_str(), port));
|
getCuid(), addr.c_str(), port));
|
||||||
createSocket();
|
createSocket();
|
||||||
getSocket()->establishConnection(addr, port);
|
getSocket()->establishConnection(addr, port);
|
||||||
|
getSocket()->setTcpNodelay(true);
|
||||||
|
|
||||||
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
||||||
if(proxyMethod == V_TUNNEL) {
|
if(proxyMethod == V_TUNNEL) {
|
||||||
|
@ -139,6 +140,8 @@ Command* HttpInitiateConnectionCommand::createNextCommand
|
||||||
getCuid(), addr.c_str(), port));
|
getCuid(), addr.c_str(), port));
|
||||||
createSocket();
|
createSocket();
|
||||||
getSocket()->establishConnection(addr, port);
|
getSocket()->establishConnection(addr, port);
|
||||||
|
getSocket()->setTcpNodelay(true);
|
||||||
|
|
||||||
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
||||||
} else {
|
} else {
|
||||||
setSocket(pooledSocket);
|
setSocket(pooledSocket);
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool HttpListenCommand::execute()
|
||||||
try {
|
try {
|
||||||
if(serverSocket_->isReadable(0)) {
|
if(serverSocket_->isReadable(0)) {
|
||||||
SharedHandle<SocketCore> socket(serverSocket_->acceptConnection());
|
SharedHandle<SocketCore> socket(serverSocket_->acceptConnection());
|
||||||
|
socket->setTcpNodelay(true);
|
||||||
std::pair<std::string, uint16_t> peerInfo;
|
std::pair<std::string, uint16_t> peerInfo;
|
||||||
socket->getPeerInfo(peerInfo);
|
socket->getPeerInfo(peerInfo);
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,6 @@ SharedHandle<SocketCore> SocketCore::acceptConnection() const
|
||||||
}
|
}
|
||||||
SharedHandle<SocketCore> sock(new SocketCore(fd, sockType_));
|
SharedHandle<SocketCore> sock(new SocketCore(fd, sockType_));
|
||||||
sock->setNonBlockingMode();
|
sock->setNonBlockingMode();
|
||||||
sock->setTcpNodelay(true);
|
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +461,6 @@ void SocketCore::establishConnection(const std::string& host, uint16_t port)
|
||||||
sockfd_ = fd;
|
sockfd_ = fd;
|
||||||
// make socket non-blocking mode
|
// make socket non-blocking mode
|
||||||
setNonBlockingMode();
|
setNonBlockingMode();
|
||||||
setTcpNodelay(true);
|
|
||||||
if(connect(fd, rp->ai_addr, rp->ai_addrlen) == -1 &&
|
if(connect(fd, rp->ai_addr, rp->ai_addrlen) == -1 &&
|
||||||
SOCKET_ERRNO != A2_EINPROGRESS) {
|
SOCKET_ERRNO != A2_EINPROGRESS) {
|
||||||
errNum = SOCKET_ERRNO;
|
errNum = SOCKET_ERRNO;
|
||||||
|
|
Loading…
Reference in New Issue