Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:2156:    TRACE_LEAVE("Fail.");    return ([]);    }       // Create the new lock.       string locktoken = "urn:uuid:" + roxen->new_uuid_string();    DAVLock lock = DAVLock(locktoken, path, recursive, lockscope, locktype,    expiry_delta, owner);    lock->is_file = is_file; +  array(array(string|function)) successful_locks = ({});    foreach(location_module_cache||location_modules(),    [string loc, function func])    {    string subpath;    if (has_prefix(path, loc)) {    // path == loc + subpath.    subpath = path[sizeof(loc)..];    } else if (recursive && has_prefix(loc, path)) {    // loc == path + ignored.    subpath = "/";    } else {    // Does not apply to this location module.    continue;    }       TRACE_ENTER(sprintf("Calling %O->lock_file(%O, %O, %O)...",    function_object(func), subpath, lock, id), 0);    mapping(string:mixed) lock_error =    function_object(func)->lock_file(subpath, lock, id);    if (lock_error) { -  // Failure. Unlock the new lock. -  foreach(location_module_cache||location_modules(), -  [string loc2, function func2]) +  // Failure. Unlock the new lock in modules where it was +  // registered successfully. +  foreach(reverse(successful_locks), [string loc2, function func2])    {    if (has_prefix(path, loc2)) {    // path == loc2 + subpath.    mapping(string:mixed) ret =    function_object(func2)->unlock_file(path[sizeof(loc2)..],    lock, id);    } else if (recursive && has_prefix(loc2, path)) {    // loc2 == path + ignored.    mapping(string:mixed) ret =    function_object(func2)->unlock_file("/", lock, id);    } -  if (func == func2) break; +     }    // destruct(lock);    TRACE_LEAVE(sprintf("Lock error: %O", lock_error));    return lock_error;    } -  +  +  successful_locks += ({ ({ loc, func }) }); +     TRACE_LEAVE("Ok.");    if (function_object(func)->webdav_opaque) break;    }       if (expiry_delta) {    // Lock with timeout.    // FIXME: Race-conditions.    if (!sizeof(active_locks)) {    // Start the lock expiration loop.    active_locks[lock] = 1;