diff --git a/ChangeLog b/ChangeLog index 0b7514c4..671a628a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-09-14 Tatsuhiro Tsujikawa + + 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 Added usage message for --uri-selector, --server-stat-of, diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index 874fe5aa..fa4d790f 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -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. diff --git a/src/Command.cc b/src/Command.cc index 116e7d5b..acc46638 100644 --- a/src/Command.cc +++ b/src/Command.cc @@ -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 diff --git a/src/Command.h b/src/Command.h index 772b916d..ffcdf83e 100644 --- a/src/Command.h +++ b/src/Command.h @@ -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(); }; diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index f8cd1287..48e6b464 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -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(); } } diff --git a/src/PeerAbstractCommand.cc b/src/PeerAbstractCommand.cc index bd525db8..26f9e7d9 100644 --- a/src/PeerAbstractCommand.cc +++ b/src/PeerAbstractCommand.cc @@ -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);