mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Perma-adding Atrides fix + setting the target for the proxied clients to 1/10th of normal.
This commit is contained in:
+9
-3
@@ -394,7 +394,13 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
|
|||||||
|
|
||||||
this.updateDifficulty = function(){
|
this.updateDifficulty = function(){
|
||||||
if (this.hashes > 0) {
|
if (this.hashes > 0) {
|
||||||
this.setNewDiff(Math.floor(this.hashes / (Math.floor((Date.now() - this.connectTime) / 1000))) * global.config.pool.targetTime);
|
let newDiff = 0;
|
||||||
|
if (this.proxy){
|
||||||
|
newDiff = Math.floor(Math.floor(this.hashes / (Math.floor((Date.now() - this.connectTime) / 1000))) * global.config.pool.targetTime/10);
|
||||||
|
} else {
|
||||||
|
newDiff = Math.floor(this.hashes / (Math.floor((Date.now() - this.connectTime) / 1000))) * global.config.pool.targetTime;
|
||||||
|
}
|
||||||
|
this.setNewDiff(newDiff);
|
||||||
} else {
|
} else {
|
||||||
this.updateDifficultyOld();
|
this.updateDifficultyOld();
|
||||||
}
|
}
|
||||||
@@ -403,7 +409,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
|
|||||||
this.setNewDiff = function (difficulty) {
|
this.setNewDiff = function (difficulty) {
|
||||||
this.newDiff = Math.round(difficulty);
|
this.newDiff = Math.round(difficulty);
|
||||||
debug(threadName + "Difficulty: " + this.newDiff + " For: " + this.logString + " Time Average: " + this.shareTimeBuffer.average(this.lastShareTime) + " Entries: " + this.shareTimeBuffer.size() + " Sum: " + this.shareTimeBuffer.sum());
|
debug(threadName + "Difficulty: " + this.newDiff + " For: " + this.logString + " Time Average: " + this.shareTimeBuffer.average(this.lastShareTime) + " Entries: " + this.shareTimeBuffer.size() + " Sum: " + this.shareTimeBuffer.sum());
|
||||||
if (this.newDiff > global.config.pool.maxDifficulty) {
|
if (this.newDiff > global.config.pool.maxDifficulty && !this.proxy) {
|
||||||
this.newDiff = global.config.pool.maxDifficulty;
|
this.newDiff = global.config.pool.maxDifficulty;
|
||||||
}
|
}
|
||||||
if (this.difficulty === this.newDiff) {
|
if (this.difficulty === this.newDiff) {
|
||||||
@@ -876,7 +882,7 @@ if (cluster.isMaster) {
|
|||||||
|
|
||||||
socket.on('data', function (d) {
|
socket.on('data', function (d) {
|
||||||
dataBuffer += d;
|
dataBuffer += d;
|
||||||
if (Buffer.byteLength(dataBuffer, 'utf8') > 10240) { //10KB
|
if (Buffer.byteLength(dataBuffer, 'utf8') > 102400) { //10KB
|
||||||
dataBuffer = null;
|
dataBuffer = null;
|
||||||
console.warn(threadName + 'Excessive packet size from: ' + socket.remoteAddress);
|
console.warn(threadName + 'Excessive packet size from: ' + socket.remoteAddress);
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
|||||||
Reference in New Issue
Block a user