|
|
@ -926,6 +926,7 @@ HK.onDirectMessage = function (Env, Server, seq, userId, json) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onChecked = Util.mkEvent();
|
|
|
|
const onChecked = Util.mkEvent();
|
|
|
|
|
|
|
|
|
|
|
|
// Create our workers
|
|
|
|
// Create our workers
|
|
|
|
const workers = [];
|
|
|
|
const workers = [];
|
|
|
|
for (let i = 0; i < numCPUs; i++) {
|
|
|
|
for (let i = 0; i < numCPUs; i++) {
|
|
|
@ -951,6 +952,12 @@ var initWorker = function (worker) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
workers.forEach(initWorker);
|
|
|
|
workers.forEach(initWorker);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const validateMessage = function (msg) {
|
|
|
|
|
|
|
|
nextWorker = (nextWorker + 1) % workers.length;
|
|
|
|
|
|
|
|
// Send the request
|
|
|
|
|
|
|
|
workers[nextWorker].send(msg);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
|
|
|
|
HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
|
|
|
|
console.log(+new Date(), "onChannelMessage");
|
|
|
|
console.log(+new Date(), "onChannelMessage");
|
|
|
|
const Log = Env.Log;
|
|
|
|
const Log = Env.Log;
|
|
|
@ -1018,13 +1025,11 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
|
|
|
|
onChecked.reg(onCheck);
|
|
|
|
onChecked.reg(onCheck);
|
|
|
|
|
|
|
|
|
|
|
|
console.log(+new Date(), "Send verification request");
|
|
|
|
console.log(+new Date(), "Send verification request");
|
|
|
|
// Send the request
|
|
|
|
validateMessage( {
|
|
|
|
workers[nextWorker].send({
|
|
|
|
|
|
|
|
txid: txid,
|
|
|
|
txid: txid,
|
|
|
|
msg: signedMsg,
|
|
|
|
msg: signedMsg,
|
|
|
|
key: metadata.validateKey
|
|
|
|
key: metadata.validateKey
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (++nextWorker > numCPUs) { nextWorker = 0; }
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
// do checkpoint stuff...
|
|
|
|
// do checkpoint stuff...
|
|
|
|
|
|
|
|
|
|
|
|