mirror of https://github.com/aria2/aria2
2008-05-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Don't add closed socket to DownloadEngine::addSocketForReadCheck() * src/AbstractCommand.cc * src/AbstractCommand.h * src/ActivePeerConnectionCommand.cc * src/FtpInitiateConnectionCommand.cc * src/HttpInitiateConnectionCommand.cc * src/InitiateConnectionCommandFactory.cc * src/PeerAbstractCommand.cc * src/PeerAbstractCommand.h * src/PeerInitiateConnectionCommand.cc * src/TrackerWatcherCommand.ccpull/1/head
parent
b5f1ca6f66
commit
7c6ed037e3
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2008-05-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Don't add closed socket to DownloadEngine::addSocketForReadCheck()
|
||||
* src/AbstractCommand.cc
|
||||
* src/AbstractCommand.h
|
||||
* src/ActivePeerConnectionCommand.cc
|
||||
* src/FtpInitiateConnectionCommand.cc
|
||||
* src/HttpInitiateConnectionCommand.cc
|
||||
* src/InitiateConnectionCommandFactory.cc
|
||||
* src/PeerAbstractCommand.cc
|
||||
* src/PeerAbstractCommand.h
|
||||
* src/PeerInitiateConnectionCommand.cc
|
||||
* src/TrackerWatcherCommand.cc
|
||||
|
||||
2008-05-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Sort RequestSlot in ascending order and manipulate them using
|
||||
|
|
|
@ -58,8 +58,6 @@
|
|||
|
||||
namespace aria2 {
|
||||
|
||||
// TODO $$$$$$$$$$$ fix two nearly identical constructor. $$$$$$$$$$$$$$
|
||||
// Modify two constructor at the same time!
|
||||
AbstractCommand::AbstractCommand(int32_t cuid,
|
||||
const SharedHandle<Request>& req,
|
||||
RequestGroup* requestGroup,
|
||||
|
@ -70,21 +68,9 @@ AbstractCommand::AbstractCommand(int32_t cuid,
|
|||
checkSocketIsReadable(false), checkSocketIsWritable(false),
|
||||
nameResolverCheck(false)
|
||||
{
|
||||
if(!socket.isNull() && socket->isOpen()) {
|
||||
setReadCheckSocket(socket);
|
||||
timeout = this->e->option->getAsInt(PREF_TIMEOUT);
|
||||
_requestGroup->increaseStreamConnection();
|
||||
}
|
||||
|
||||
AbstractCommand::AbstractCommand(int32_t cuid,
|
||||
const SharedHandle<Request>& req,
|
||||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e):
|
||||
Command(cuid), RequestGroupAware(requestGroup),
|
||||
req(req), e(e), socket(new SocketCore()),
|
||||
checkSocketIsReadable(false), checkSocketIsWritable(false),
|
||||
nameResolverCheck(false)
|
||||
{
|
||||
setReadCheckSocket(socket);
|
||||
}
|
||||
timeout = this->e->option->getAsInt(PREF_TIMEOUT);
|
||||
_requestGroup->increaseStreamConnection();
|
||||
}
|
||||
|
|
|
@ -106,10 +106,7 @@ private:
|
|||
public:
|
||||
AbstractCommand(int32_t cuid, const SharedHandle<Request>& req,
|
||||
RequestGroup* requestGroup, DownloadEngine* e,
|
||||
const SharedHandle<SocketCore>& s);
|
||||
|
||||
AbstractCommand(int32_t cuid, const SharedHandle<Request>& req,
|
||||
RequestGroup* requestGroup, DownloadEngine* e);
|
||||
const SharedHandle<SocketCore>& s = SharedHandle<SocketCore>());
|
||||
|
||||
virtual ~AbstractCommand();
|
||||
bool execute();
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "prefs.h"
|
||||
#include "Option.h"
|
||||
#include "BtConstants.h"
|
||||
#include "SocketCore.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
|||
logger->info(MSG_CONNECTING_TO_SERVER, cuid,
|
||||
e->option->get(PREF_HTTP_PROXY_HOST).c_str(),
|
||||
e->option->getAsInt(PREF_HTTP_PROXY_PORT));
|
||||
socket.reset(new SocketCore());
|
||||
socket->establishConnection(resolvedAddresses.front(),
|
||||
e->option->getAsInt(PREF_HTTP_PROXY_PORT));
|
||||
|
||||
|
@ -86,6 +87,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
|||
|
||||
logger->info(MSG_CONNECTING_TO_SERVER, cuid, req->getHost().c_str(),
|
||||
req->getPort());
|
||||
socket.reset(new SocketCore());
|
||||
socket->establishConnection(resolvedAddresses.front(), req->getPort());
|
||||
command = new FtpNegotiationCommand(cuid, req, _requestGroup, e, socket);
|
||||
} else {
|
||||
|
|
|
@ -66,6 +66,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand
|
|||
logger->info(MSG_CONNECTING_TO_SERVER, cuid,
|
||||
e->option->get(PREF_HTTP_PROXY_HOST).c_str(),
|
||||
e->option->getAsInt(PREF_HTTP_PROXY_PORT));
|
||||
socket.reset(new SocketCore());
|
||||
socket->establishConnection(resolvedAddresses.front(),
|
||||
e->option->getAsInt(PREF_HTTP_PROXY_PORT));
|
||||
if(useProxyTunnel()) {
|
||||
|
@ -84,6 +85,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand
|
|||
if(pooledSocket.isNull()) {
|
||||
logger->info(MSG_CONNECTING_TO_SERVER, cuid, req->getHost().c_str(),
|
||||
req->getPort());
|
||||
socket.reset(new SocketCore());
|
||||
socket->establishConnection(resolvedAddresses.front(), req->getPort());
|
||||
} else {
|
||||
socket = pooledSocket;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "StringFormat.h"
|
||||
#include "Option.h"
|
||||
#include "prefs.h"
|
||||
#include "SocketCore.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
|
|
@ -52,18 +52,9 @@ PeerAbstractCommand::PeerAbstractCommand(int32_t cuid,
|
|||
checkSocketIsReadable(false), checkSocketIsWritable(false),
|
||||
uploadLimitCheck(false), uploadLimit(0), noCheck(false)
|
||||
{
|
||||
if(!socket.isNull() && socket->isOpen()) {
|
||||
setReadCheckSocket(socket);
|
||||
timeout = e->option->getAsInt(PREF_BT_TIMEOUT);
|
||||
}
|
||||
|
||||
PeerAbstractCommand::PeerAbstractCommand(int32_t cuid,
|
||||
const PeerHandle& peer,
|
||||
DownloadEngine* e)
|
||||
:Command(cuid), e(e), socket(new SocketCore()), peer(peer),
|
||||
checkSocketIsReadable(false), checkSocketIsWritable(false),
|
||||
uploadLimitCheck(false), uploadLimit(0), noCheck(false)
|
||||
{
|
||||
setReadCheckSocket(socket);
|
||||
}
|
||||
timeout = e->option->getAsInt(PREF_BT_TIMEOUT);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,11 +80,7 @@ public:
|
|||
PeerAbstractCommand(int32_t cuid,
|
||||
const SharedHandle<Peer>& peer,
|
||||
DownloadEngine* e,
|
||||
const SharedHandle<SocketCore>& s);
|
||||
|
||||
PeerAbstractCommand(int32_t cuid,
|
||||
const SharedHandle<Peer>& peer,
|
||||
DownloadEngine* e);
|
||||
const SharedHandle<SocketCore>& s = SharedHandle<SocketCore>());
|
||||
|
||||
virtual ~PeerAbstractCommand();
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ PeerInitiateConnectionCommand::~PeerInitiateConnectionCommand()
|
|||
bool PeerInitiateConnectionCommand::executeInternal() {
|
||||
logger->info(MSG_CONNECTING_TO_SERVER, cuid, peer->ipaddr.c_str(),
|
||||
peer->port);
|
||||
socket.reset(new SocketCore());
|
||||
socket->establishConnection(peer->ipaddr, peer->port);
|
||||
Command* command;
|
||||
if(_mseHandshakeEnabled) {
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "DlAbortEx.h"
|
||||
#include "Logger.h"
|
||||
#include "A2STR.h"
|
||||
#include "SocketCore.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace aria2 {
|
||||
|
|
Loading…
Reference in New Issue