2008-09-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

If error event is received in epoll, then abort download 
immediately.
	* src/AbstractCommand.cc
	* src/Command.cc
	* src/Command.h
	* src/DownloadEngine.cc
	* src/PeerAbstractCommand.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2008-09-14 13:43:34 +00:00
parent 81b2e6e108
commit 0680ac5e5e
6 changed files with 33 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2008-09-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
If error event is received in epoll, then abort download immediately.
* src/AbstractCommand.cc
* src/Command.cc
* src/Command.h
* src/DownloadEngine.cc
* src/PeerAbstractCommand.cc
2008-09-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added usage message for --uri-selector, --server-stat-of,

View File

@ -107,7 +107,7 @@ bool AbstractCommand::execute() {
}
if((checkSocketIsReadable && _readEvent) ||
(checkSocketIsWritable && _writeEvent) ||
_errorEvent ||
_hupEvent ||
#ifdef ENABLE_ASYNC_DNS
(nameResolverCheck && nameResolveFinished()) ||
#endif // ENABLE_ASYNC_DNS
@ -136,6 +136,8 @@ bool AbstractCommand::execute() {
}
}
return executeInternal();
} else if(_errorEvent) {
throw DlRetryEx("Network problem has occurred.");
} else {
if(checkPoint.elapsed(timeout)) {
// timeout triggers ServerStat error state.

View File

@ -46,7 +46,8 @@ Command::Command(int32_t cuid):uuid(uuidGen++),
logger(LogFactory::getInstance()),
_readEvent(false),
_writeEvent(false),
_errorEvent(false) {}
_errorEvent(false),
_hupEvent(false) {}
void Command::transitStatus()
{
@ -73,16 +74,22 @@ void Command::writeEventReceived()
_writeEvent = true;
}
void Command::errorEventRecieved()
void Command::errorEventReceived()
{
_errorEvent = true;
}
void Command::hupEventReceived()
{
_hupEvent = true;
}
void Command::clearIOEvents()
{
_readEvent = false;
_writeEvent = false;
_errorEvent = false;
_hupEvent = false;
}
} // namespace aria2

View File

@ -65,6 +65,7 @@ protected:
bool _readEvent;
bool _writeEvent;
bool _errorEvent;
bool _hupEvent;
public:
Command(int32_t cuid);
@ -95,7 +96,9 @@ public:
void writeEventReceived();
void errorEventRecieved();
void errorEventReceived();
void hupEventReceived();
void clearIOEvents();
};

View File

@ -109,8 +109,11 @@ void CommandEvent::processEvents(int events)
if(SocketEntry::EVENT_WRITE&events) {
_command->writeEventReceived();
}
if((SocketEntry::EVENT_ERROR|SocketEntry::EVENT_HUP)&events) {
_command->errorEventRecieved();
if(SocketEntry::EVENT_ERROR&events) {
_command->errorEventReceived();
}
if(SocketEntry::EVENT_HUP&events) {
_command->hupEventReceived();
}
}

View File

@ -81,8 +81,10 @@ bool PeerAbstractCommand::execute()
if(noCheck ||
(checkSocketIsReadable && _readEvent) ||
(checkSocketIsWritable && _writeEvent) ||
_errorEvent) {
_hupEvent) {
checkPoint.reset();
} else if(_errorEvent) {
throw DlAbortEx("Network problem has occurred.");
}
if(checkPoint.elapsed(timeout)) {
throw DlAbortEx(EX_TIME_OUT);