merge master back to staging
This commit is contained in:
commit
3f2ebb773b
@ -236,10 +236,7 @@ const computeIndex = function (Env, channelName, cb) {
|
|||||||
let size = 0;
|
let size = 0;
|
||||||
nThen(function (w) {
|
nThen(function (w) {
|
||||||
getMetadata(Env, channelName, w(function (err, _metadata) {
|
getMetadata(Env, channelName, w(function (err, _metadata) {
|
||||||
if (err) {
|
//if (err) { console.log(err); }
|
||||||
console.log(err);
|
|
||||||
throw new Error(err); // XXX
|
|
||||||
}
|
|
||||||
metadata = _metadata;
|
metadata = _metadata;
|
||||||
}));
|
}));
|
||||||
}).nThen(function (w) {
|
}).nThen(function (w) {
|
||||||
@ -251,17 +248,14 @@ const computeIndex = function (Env, channelName, cb) {
|
|||||||
let msg;
|
let msg;
|
||||||
// keep an eye out for the metadata line if you haven't already seen it
|
// keep an eye out for the metadata line if you haven't already seen it
|
||||||
// but only check for metadata on the first line
|
// but only check for metadata on the first line
|
||||||
if (!i && msgObj.buff.indexOf('{') === 0) { // XXX RESTRICT metadata...
|
if (!i && msgObj.buff.indexOf('{') === 0) {
|
||||||
i++; // always increment the message counter
|
i++; // always increment the message counter
|
||||||
msg = tryParse(Env, msgObj.buff.toString('utf8'));
|
msg = tryParse(Env, msgObj.buff.toString('utf8'));
|
||||||
if (typeof msg === "undefined") { return readMore(); }
|
if (typeof msg === "undefined") { return readMore(); }
|
||||||
|
|
||||||
// validate that the current line really is metadata before storing it as such
|
// validate that the current line really is metadata before storing it as such
|
||||||
if (isMetadataMessage(msg)) { // XXX RESTRICT
|
// skip this, as you already have metadata...
|
||||||
//metadata = msg; // XXX RESTRICT
|
if (isMetadataMessage(msg)) { return readMore(); }
|
||||||
// skip this, as you already have metadata...
|
|
||||||
return readMore();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
if (msgObj.buff.indexOf('cp|') > -1) {
|
if (msgObj.buff.indexOf('cp|') > -1) {
|
||||||
@ -700,7 +694,7 @@ const handleGetHistory = function (Env, Server, seq, userId, parsed) {
|
|||||||
}, (err) => {
|
}, (err) => {
|
||||||
if (err && err.code !== 'ENOENT') {
|
if (err && err.code !== 'ENOENT') {
|
||||||
if (err.message !== 'EINVAL') { Log.error("HK_GET_HISTORY", err); }
|
if (err.message !== 'EINVAL') { Log.error("HK_GET_HISTORY", err); }
|
||||||
const parsedMsg = {error:err.message, channel: channelName, txid: txid}; // XXX history retrieval error format
|
const parsedMsg = {error:err.message, channel: channelName, txid: txid};
|
||||||
Server.send(userId, [0, HISTORY_KEEPER_ID, 'MSG', userId, JSON.stringify(parsedMsg)]);
|
Server.send(userId, [0, HISTORY_KEEPER_ID, 'MSG', userId, JSON.stringify(parsedMsg)]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -827,9 +821,9 @@ const handleGetFullHistory = function (Env, Server, seq, userId, parsed) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const directMessageCommands = {
|
const directMessageCommands = {
|
||||||
GET_HISTORY: handleGetHistory, // XXX RESTRICT
|
GET_HISTORY: handleGetHistory,
|
||||||
GET_HISTORY_RANGE: handleGetHistoryRange, // XXX RESTRICT
|
GET_HISTORY_RANGE: handleGetHistoryRange,
|
||||||
GET_FULL_HISTORY: handleGetFullHistory, // XXX RESTRICT
|
GET_FULL_HISTORY: handleGetFullHistory,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* onDirectMessage
|
/* onDirectMessage
|
||||||
@ -883,7 +877,6 @@ HK.onDirectMessage = function (Env, Server, seq, userId, json) {
|
|||||||
if (checkExpired(Env, Server, parsed[1])) {
|
if (checkExpired(Env, Server, parsed[1])) {
|
||||||
// if the channel is expired just abort.
|
// if the channel is expired just abort.
|
||||||
w.abort();
|
w.abort();
|
||||||
// XXX what do we tell the person who asked?
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user