Merge branch 'reconnect' into staging

This commit is contained in:
yflory
2020-03-26 15:24:38 +01:00
6 changed files with 64 additions and 28 deletions

View File

@@ -325,7 +325,7 @@ const storeMessage = function (Env, channel, msg, isCp, optionalMessageHash) {
* it has a side-effect of filling the index cache if it's empty
1. if you provided a lastKnownHash and that message does not exist in the history:
* either the client has made a mistake or the history they knew about no longer exists
* call back with EINVAL
* call back with EUNKNOWN
2. if you did not provide a lastKnownHash
* and there are fewer than two checkpoints:
* return 0 (read from the start of the file)
@@ -360,7 +360,7 @@ const getHistoryOffset = (Env, channelName, lastKnownHash, _cb) => {
// QUESTION: does this mean mailboxes are causing the server to store too much stuff in memory?
if (lastKnownHash && typeof(lkh) !== "number") {
waitFor.abort();
return void cb(new Error('EINVAL'));
return void cb(new Error('EUNKNOWN'));
}
// Since last 2 checkpoints