diff options
author | John McLear <john@mclear.co.uk> | 2014-11-04 19:55:05 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2014-11-04 19:55:05 +0000 |
commit | 68eaa09708241b0551f5d345f45d8f7ba00913d2 (patch) | |
tree | 8b81134bd854ecb282873024b1f4f6ed77c88669 /src/node | |
parent | 95e7b0f15609fc850b71717a672abd02237a0f33 (diff) | |
download | etherpad-lite-68eaa09708241b0551f5d345f45d8f7ba00913d2.zip |
Begin to repair damage done to rooms logic
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/handler/PadMessageHandler.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index da2a7a14..2072a784 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -754,9 +754,14 @@ function handleUserChanges(data, cb) exports.updatePadClients = function(pad, callback) { - /* //skip this step if noone is on this pad - var roomClients = socketio.sockets.clients(pad.id); + var roomClients = [], room = socketio.sockets.adapter.rooms[pad.id]; + if (room) { + for (var id in room) { + roomClients.push(socketio.sockets.adapter.nsp.connected[id]); + } + } + if(roomClients.length==0) return callback(); @@ -769,10 +774,8 @@ exports.updatePadClients = function(pad, callback) var revCache = {}; //go trough all sessions on this pad - async.forEach(roomClients, function(client, callback) - { + async.forEach(roomClients, function(client, callback){ var sid = client.id; - //https://github.com/caolan/async#whilst //send them all new changesets async.whilst( @@ -802,7 +805,8 @@ exports.updatePadClients = function(pad, callback) if(author == sessioninfos[sid].author) { - client.json.send({"type":"COLLABROOM","data":{type:"ACCEPT_COMMIT", newRev:r}}); + // client.json.send({"type":"COLLABROOM","data":{type:"ACCEPT_COMMIT", newRev:r}}); + socketio.in(pad).send({"type":"COLLABROOM","data":{type:"ACCEPT_COMMIT", newRev:r}}); } else { @@ -817,7 +821,9 @@ exports.updatePadClients = function(pad, callback) timeDelta: currentTime - sessioninfos[sid].time }}; - client.json.send(wireMsg); + // client.json.send(wireMsg); + socketio.in(pad).send({"type":"COLLABROOM","data":{type:"ACCEPT_COMMIT", newRev:r}}); + } sessioninfos[sid].time = currentTime; @@ -830,7 +836,6 @@ exports.updatePadClients = function(pad, callback) callback ); },callback); - */ } /** |