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
pull/1/head
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> 2008-09-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added usage message for --uri-selector, --server-stat-of, Added usage message for --uri-selector, --server-stat-of,

View File

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

View File

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

View File

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

View File

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

View File

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