From a5992b86a94087a6b00d7af8674b1082e6dda5b9 Mon Sep 17 00:00:00 2001 From: mcmlxxix <> Date: Fri, 21 Oct 2011 18:47:58 +0000 Subject: [PATCH] fix bugs caused directly by deuce and no one else but deuce --- exec/load/json-db.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exec/load/json-db.js b/exec/load/json-db.js index 7ba2144c2a..27a4470269 100644 --- a/exec/load/json-db.js +++ b/exec/load/json-db.js @@ -347,9 +347,8 @@ function JSONdb (fileName) { return true; /* if this client has this record locked */ else if(record.shadow[record.child_name]._lock[client.id] && - record.shadow[record.child_name]._lock[client.id].type == locks.WRITE) { + record.shadow[record.child_name]._lock[client.id].type == locks.WRITE) { delete record.data[record.child_name]; - delete record.shadow[record.child_name]; /* send data updates to all subscribers */ return true; } @@ -708,15 +707,16 @@ function JSONdb (fileName) { var p=parent_name.split(/\./); for each(var c in p) { /* in the event of a write request, create new data if it does not exist*/ - if(data[c] === undefined && create_new) - create_data(data,c); /* ensure that the shadow object exists in order to allow for non-read operations */ if(shadow[c] === undefined) - create_shadow(data,c); + create_shadow(shadow,c); + shadow=shadow[c]; /* keep track of current object, and store the immediate parent of the request object */ - if(data !== undefined) + if(data !== undefined) { + if(data[c] === undefined && create_new) + create_data(data,c); data=data[c]; - shadow=shadow[c]; + } /* check the current object's lock and subscriber status along the way */ info = investigate(shadow,info); } -- GitLab