mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-23 06:18:34 +02:00
Moving share validation into remoteShare before it ever gets to our internal processing DB loop.
This commit is contained in:
+7
-1
@@ -37,7 +37,11 @@ app.post('/leafApi', function (req, res) {
|
||||
}
|
||||
switch (msgData.msgType) {
|
||||
case global.protos.MESSAGETYPE.SHARE:
|
||||
process.send({block: msgData.exInt, data: msgData.msg});
|
||||
try {
|
||||
global.protos.Share.decode(msgData.msg);
|
||||
process.send({block: msgData.exInt, data: msgData.msg});
|
||||
} catch (e){
|
||||
}
|
||||
return res.json({'success': true});
|
||||
case global.protos.MESSAGETYPE.BLOCK:
|
||||
global.database.storeBlock(msgData.exInt, msgData.msg, function(data){
|
||||
@@ -80,6 +84,7 @@ if (cluster.isMaster) {
|
||||
|
||||
for (let i = 0; i < numWorkers; i++) {
|
||||
let worker = cluster.fork();
|
||||
worker.on('message', messageHandler);
|
||||
workerList.push(worker);
|
||||
}
|
||||
|
||||
@@ -91,6 +96,7 @@ if (cluster.isMaster) {
|
||||
console.log('Worker ' + worker.process.pid + ' died with code: ' + code + ', and signal: ' + signal);
|
||||
console.log('Starting a new worker');
|
||||
worker = cluster.fork();
|
||||
worker.on('message', messageHandler);
|
||||
workerList.push(worker);
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user