Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/node/handler/PadMessageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,14 @@ function handleUserChanges(data, cb)
// and can be applied after "c".
try
{
// a changeset can be based on an old revision with the same changes in it
// prevent eplite from accepting it TODO: better send the client a NEW_CHANGES
// of that revision
if(baseRev+1 == r && c == changeset) {
client.json.send({disconnect:"badChangeset"});
stats.meter('failedChangesets').mark();
return callback(new Error("Won't apply USER_CHANGES, because it contains an already accepted changeset"));
}
changeset = Changeset.follow(c, changeset, false, apool);
}catch(e){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, you can conveniently just throw the error here, and have the catch block do the work for you... DRYs things up ;)

client.json.send({disconnect:"badChangeset"});
Expand Down