Prevent multiple lock requests from being executed (bug 441922, r=thunder)

This commit is contained in:
Anant Narayanan 2008-06-26 11:15:02 -07:00
Родитель 19b2afb2b9
Коммит b580a586dc
3 изменённых файлов: 12 добавлений и 5 удалений

Просмотреть файл

@ -192,6 +192,8 @@ Generator.prototype = {
this._exception = e;
} else if (e.message && e.message == 'Cannot acquire lock (internal lock)') {
this._log.warn("Exception: " + Utils.exceptionStr(e));
} else {
this._log.error("Exception: " + Utils.exceptionStr(e));
this._log.debug("Stack trace:\n" + Utils.stackTrace(e));

Просмотреть файл

@ -252,9 +252,6 @@ DAVCollection.prototype = {
},
LOCK: function DC_LOCK(path, data, onComplete) {
if (!this._lockAllowed)
throw "Cannot acquire lock (internal lock)";
let headers = {'Content-type': 'text/xml; charset="utf-8"',
'Depth': 'infinity',
'Timeout': 'Second-600'};
@ -364,6 +361,9 @@ DAVCollection.prototype = {
let self = yield;
this._log.trace("Acquiring lock");
if (!this._lockAllowed)
throw {message: "Cannot acquire lock (internal lock)"};
this._lockAllowed = false;
if (DAVLocks['default']) {
this._log.debug("Lock called, but we already hold a token");
@ -379,8 +379,10 @@ DAVCollection.prototype = {
"</D:lockinfo>", self.cb);
let resp = yield;
if (resp.status < 200 || resp.status >= 300)
if (resp.status < 200 || resp.status >= 300) {
this._lockAllowed = true;
return;
}
let tokens = Utils.xpath(resp.responseXML, '//D:locktoken/D:href');
let token = tokens.iterateNext();
@ -393,11 +395,14 @@ DAVCollection.prototype = {
if (!DAVLocks['default']) {
this._log.warn("Could not acquire lock");
this._lockAllowed = true;
self.done();
return;
}
this._log.trace("Lock acquired");
this._lockAllowed = true;
self.done(DAVLocks['default']);
},

Просмотреть файл

@ -203,7 +203,7 @@ let Utils = {
},
exceptionStr: function Weave_exceptionStr(e) {
let message = e.message? e.message : e;
let message = e.message ? e.message : e;
let location = "";
if (e.location)