Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS.   //      // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.704 2010/09/28 12:23:32 mast Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.705 2010/11/02 17:17:52 marty Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>   #include <timers.h>      #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // Tell Pike.count_memory this is global.   constant pike_cycle_depth = 0;
Roxen.git/server/base_server/configuration.pike:1854:    if (lock->expiry_time < t) {    unlock_file(lock->path, lock, id);    } else if (lock->expiry_time < min_time) {    min_time = lock->expiry_time;    }    }    }    return min_time - t;   }    + mixed expire_lock_loop_handle; +    protected void expire_lock_loop()   {    int t = expire_locks(0); // NOTE: Called with RequestID 0!       if (sizeof(active_locks)) { -  // Expire locks at least once every hour. -  if (t < 3600) { -  roxen.background_run(t, expire_lock_loop); -  } else { -  roxen.background_run(3600, expire_lock_loop); +  t = max (t, 1); // Wait at least one second before the next run. +  t = min (t, 3600); // Expire locks at least once every hour. +  +  if (expire_lock_loop_handle) +  remove_call_out (expire_lock_loop_handle); +  +  expire_lock_loop_handle = roxen.background_run(t, expire_lock_loop);    }   } - } +       //! Refresh a lock.   //!   //! Update the expiry time for the lock.   void refresh_lock(DAVLock lock)   {    if (lock->expiry_delta) { -  lock->expiry_time = lock->expiry_delta + time(1); +  // Use time() instead of time(1) to avoid expiring the lock too +  // early if the returned time is old. Probably unlikely, but +  // anyways. +  lock->expiry_time = lock->expiry_delta + time();    }   }      //! Attempt to lock @[path].   //!   //! @param path   //! Path to lock.   //!   //! @param locktype   //! Type of lock (currently only @expr{"DAV:write"@} is defined).