diff --git a/ChangeLog b/ChangeLog index 0f5d6776..2e86ab6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-06-03 Tatsuhiro Tsujikawa + + Treat SIGHUP and SIGTERM signal as emergency shutdown because they + are usually issued by system or other process. + * src/MultiUrlRequestInfo.cc + 2010-06-03 Tatsuhiro Tsujikawa Use downloadresultcode::IN_PROGRESS for diff --git a/src/MultiUrlRequestInfo.cc b/src/MultiUrlRequestInfo.cc index c7b9ca43..b152b453 100644 --- a/src/MultiUrlRequestInfo.cc +++ b/src/MultiUrlRequestInfo.cc @@ -75,10 +75,20 @@ extern volatile sig_atomic_t globalHaltRequested; } // namespace global static void handler(int signal) { - if(global::globalHaltRequested == 0) { - global::globalHaltRequested = 1; - } else if(global::globalHaltRequested == 2) { - global::globalHaltRequested = 3; + if( +#ifdef SIGHUP + signal == SIGHUP || +#endif // SIGHUP + signal == SIGTERM) { + if(global::globalHaltRequested == 0 || global::globalHaltRequested == 2) { + global::globalHaltRequested = 3; + } + } else { + if(global::globalHaltRequested == 0) { + global::globalHaltRequested = 1; + } else if(global::globalHaltRequested == 2) { + global::globalHaltRequested = 3; + } } }