Branch: Tag:

2002-04-25

2002-04-25 14:42:08 by Anders Johansson <anders@roxen.com>

Improved suicide handling and som more debug.

Rev: server/base_server/roxen.pike:1.782

6:   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.781 2002/04/23 16:20:51 grubba Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.782 2002/04/25 14:42:08 anders Exp $";      // The argument cache. Used by the image cache.   ArgCache argcache;
4375:   void check_commit_suicide()   {   #ifdef SUICIDE_DEBUG -  werror("check_commit_suicide(): Engage:%d, schedule: %d, time: %d\n", +  werror("check_commit_suicide(): Engage:%d, schedule: %d, time: %d\n" +  " Schedule: %s",    query("suicide_engage"),    getvar("suicide_schedule")->get_next( query("last_suicide")), -  time()); +  time(), +  ctime(getvar("suicide_schedule")->get_next( query("last_suicide"))));   #endif /* SUICIDE_DEBUG */    if (query("suicide_engage")) {    int next = getvar("suicide_schedule")    ->get_next( query("last_suicide") );    if (next >= 0 && next <= time(1)) {    report_notice("Auto Restart triggered.\n"); -  +  set( "last_suicide", time(1) ); +  save( );    restart();    } else {    call_out(check_commit_suicide, next - time(1));
4395:   void check_suicide( )   {   #ifdef SUICIDE_DEBUG -  werror("check_suicide(): Engage:%d, schedule: %d, time: %d\n", +  werror("check_suicide(): Engage:%d, schedule: %d, time: %d\n" +  " Schedule: %s",    query("suicide_engage"),    getvar("suicide_schedule")->get_next( query("last_suicide")), -  time()); +  time(), +  ctime(getvar("suicide_schedule")->get_next( query("last_suicide"))));   #endif /* SUICIDE_DEBUG */    if (query("suicide_engage")) {    int next = getvar("suicide_schedule")    ->get_next( query("last_suicide") ); -  if( next >= 0 && next < time() ) +  if( !query("last_suicide") || (next >= 0 && next <= time()) )    { -  + #ifdef SUICIDE_DEBUG +  werror("Next suicide is in the past or last time not set. Reseting.\n"); + #endif    set( "last_suicide", time() ); -  return 0; +  save( );    }    }   }