2009-06-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Call setStatus(STATUS_ONESHOT_REALTIME) from constructor.  Call
	setNoWiat(true) if newly created command calls
	setStatus(STATUS_ONESHOT_REALTIME) from its constructor.
	* src/HttpListenCommand.cc
	* src/HttpServerBodyCommand.cc
	* src/HttpServerCommand.cc
	* src/HttpServerResponseCommand.cc
	* src/InitiateConnectionCommand.cc
	* src/RequestGroup.cc
	* src/StreamFileAllocationEntry.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-06-20 02:33:42 +00:00
parent 34b3d88795
commit 572f10af72
8 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,16 @@
2009-06-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Call setStatus(STATUS_ONESHOT_REALTIME) from constructor. Call
setNoWiat(true) if newly created command calls
setStatus(STATUS_ONESHOT_REALTIME) from its constructor.
* src/HttpListenCommand.cc
* src/HttpServerBodyCommand.cc
* src/HttpServerCommand.cc
* src/HttpServerResponseCommand.cc
* src/InitiateConnectionCommand.cc
* src/RequestGroup.cc
* src/StreamFileAllocationEntry.cc
2009-06-17 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed include vector

View File

@ -72,7 +72,6 @@ bool HttpListenCommand::execute()
HttpServerCommand* c =
new HttpServerCommand(_e->newCUID(), _e, socket);
c->setStatus(Command::STATUS_ONESHOT_REALTIME);
_e->setNoWait(true);
_e->commands.push_back(c);
}

View File

@ -62,6 +62,7 @@ HttpServerBodyCommand::HttpServerBodyCommand
_socket(socket),
_httpServer(httpServer)
{
setStatus(Command::STATUS_ONESHOT_REALTIME);
_e->addSocketForReadCheck(_socket, this);
}
@ -91,7 +92,6 @@ bool HttpServerBodyCommand::execute()
_httpServer->feedResponse(res.toXml(), "text/xml");
Command* command =
new HttpServerResponseCommand(cuid, _httpServer, _e, _socket);
command->setStatus(Command::STATUS_ONESHOT_REALTIME);
_e->commands.push_back(command);
_e->setNoWait(true);
return true;

View File

@ -56,6 +56,7 @@ HttpServerCommand::HttpServerCommand(int32_t cuid, DownloadEngine* e,
_socket(socket),
_httpServer(new HttpServer(socket, e))
{
setStatus(Command::STATUS_ONESHOT_REALTIME);
_e->addSocketForReadCheck(_socket, this);
_httpServer->setUsernamePassword(_e->option->get(PREF_XML_RPC_USER),
_e->option->get(PREF_XML_RPC_PASSWD));
@ -96,7 +97,6 @@ bool HttpServerCommand::execute()
"","text/html");
Command* command =
new HttpServerResponseCommand(cuid, _httpServer, _e, _socket);
command->setStatus(Command::STATUS_ONESHOT_REALTIME);
_e->commands.push_back(command);
_e->setNoWait(true);
return true;
@ -115,7 +115,6 @@ bool HttpServerCommand::execute()
} else {
Command* command = new HttpServerBodyCommand(cuid, _httpServer, _e,
_socket);
command->setStatus(Command::STATUS_ONESHOT_REALTIME);
_e->commands.push_back(command);
_e->setNoWait(true);
return true;

View File

@ -53,7 +53,7 @@ HttpServerResponseCommand::HttpServerResponseCommand
_socket(socket),
_httpServer(httpServer)
{
setStatus(Command::STATUS_ONESHOT_REALTIME);
_e->addSocketForWriteCheck(_socket, this);
}

View File

@ -53,6 +53,7 @@ InitiateConnectionCommand::InitiateConnectionCommand
AbstractCommand(cuid, req, requestGroup, e)
{
setTimeout(getOption()->getAsInt(PREF_DNS_TIMEOUT));
// give a chance to be executed in the next loop in DownloadEngine
setStatus(Command::STATUS_ONESHOT_REALTIME);
disableReadCheckSocket();
disableWriteCheckSocket();

View File

@ -659,8 +659,6 @@ void RequestGroup::createNextCommand(std::deque<Command*>& commands,
(e->newCUID(), req, this, e);
ServerHostHandle sv(new ServerHost(command->getCuid(), req->getHost()));
registerServerHost(sv);
// give a chance to be executed in the next loop in DownloadEngine
command->setStatus(Command::STATUS_ONESHOT_REALTIME);
commands.push_back(command);
} else {
pendingURIs.push_back(uri);
@ -670,6 +668,9 @@ void RequestGroup::createNextCommand(std::deque<Command*>& commands,
}
}
_uris.insert(_uris.begin(), pendingURIs.begin(), pendingURIs.end());
if(!commands.empty()) {
e->setNoWait(true);
}
}
std::string RequestGroup::getFilePath() const

View File

@ -63,6 +63,7 @@ void StreamFileAllocationEntry::prepareForNextAction(std::deque<Command*>& comma
if(_nextCommand) {
// give _nextCommand a chance to execute in the next execution loop.
_nextCommand->setStatus(Command::STATUS_ONESHOT_REALTIME);
e->setNoWait(true);
commands.push_back(popNextCommand());
// try remaining uris
_requestGroup->createNextCommandWithAdj(commands, e, -1);
@ -73,9 +74,8 @@ void StreamFileAllocationEntry::prepareForNextAction(std::deque<Command*>& comma
Command* command =
InitiateConnectionCommandFactory::createInitiateConnectionCommand
(e->newCUID(), _currentRequest, _requestGroup, e);
e->setNoWait(true);
commands.push_back(command);
_requestGroup->createNextCommandWithAdj(commands, e, -1);
}
}