On Fri, Dec 15, 2006 at 04:09:06AM -0500, Justin Piszcz wrote:
> lftp :~> sleep 10000; exit
> It exits immediately, like it ignores the sleep?
Here is a fix.
--
Alexander.
Index: Timer.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/Timer.cc,v
retrieving revision 1.17
diff -u -p -r1.17 Timer.cc
--- Timer.cc 6 Dec 2006 08:56:56 -0000 1.17
+++ Timer.cc 18 Dec 2006 05:41:44 -0000
@@ -51,21 +51,26 @@ void Timer::set_last_setting(const TimeI
infty_count-=IsInfty();
last_setting=i;
infty_count+=IsInfty();
+ re_set();
+}
+void Timer::re_set()
+{
+ stop=start;
+ stop+=last_setting;
+ re_sort();
}
void Timer::Set(const TimeInterval &i)
{
resource=closure=0;
+ start=SMTask::now;
set_last_setting(i);
- Reset();
}
void Timer::Reset(const Time &t)
{
if(start>=t)
return;
start=t;
- stop=t;
- stop+=last_setting;
- re_sort();
+ re_set();
}
void Timer::ResetDelayed(int s)
{
@@ -94,12 +99,7 @@ bool Timer::Stopped() const
void Timer::reconfig(const char *r)
{
if(resource && (!r || !strcmp(r,resource)))
- {
set_last_setting(TimeIntervalR(ResMgr::Query(resource,closure)));
- stop=start;
- stop+=last_setting;
- re_sort();
- }
}
void Timer::init()
{
@@ -135,7 +135,7 @@ Timer::Timer(const TimeInterval &d) : la
{
init();
infty_count+=IsInfty();
- Reset();
+ re_set();
}
Timer::Timer(const char *r,const char *c) : last_setting(0,0)
{
Index: Timer.h
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/Timer.h,v
retrieving revision 1.13
diff -u -p -r1.13 Timer.h
--- Timer.h 4 Aug 2006 07:11:49 -0000 1.13
+++ Timer.h 18 Dec 2006 06:21:22 -0000
@@ -40,6 +40,7 @@ class Timer
Timer *prev_running;
void remove_from_running_list();
void re_sort();
+ void re_set();
void set_last_setting(const TimeInterval &);
void init();
void reconfig(const char *);