Moving lock removal code to cortexLocks.js

This commit is contained in:
Dan Ballard 2011-01-24 23:27:20 -08:00
parent f84a926317
commit 9153c0896b
2 changed files with 28 additions and 2 deletions

View File

@ -204,7 +204,7 @@ function packResults(res) {
}
/*
function removeNodeRangeLocks(addr) {
for(var i in rangeLocks) {
log("freeing " + i + " locks");
@ -219,6 +219,7 @@ function removeNodeRangeLocks(addr) {
}
}
}
*/
function disconnect(addr) {
/* log("--------------DISCONNECT " + addr + "----------");
@ -241,7 +242,7 @@ function disconnect(addr) {
}
}
// range locks
removeNodeRangeLocks(addr);
//removeNodeRangeLocks(addr);
log("disconnect: freeing range locks");
}

View File

@ -72,3 +72,28 @@ function handleAddLock(resp) {
}
}
function removeNodeRangeLocks(addr) {
for(var i in rangeLocks) {
log("freeing " + i + " locks");
var rlock = rangeLocks[i];
while (rlock != null) {
log("looking at " + i + " (" + rlock.start + " to " + rlock.end + ") : " + rlock.addr);
if (rlock.addr == addr) {
log("unlocking");
rlock.locked = false;
}
rlock = rlock.next;
}
}
}
function removeNodeLocks(addr) {
removeNodeRangeLocks(resp['addr']);
}
addMsgHandler("deadNode",
function (resp) {
removeNodeLocks(resp['addr']);
});