Skip to content

Commit

Permalink
Crash while pool closing connection fixed and minor cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca committed Oct 9, 2017
1 parent b3bcf24 commit 581580a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/miners_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Miner.prototype.onData = function(obj) {
this.send({id:this.lastReqId,result:[this.ctrl.proxy.sessionId,this.ctrl.proxy.sessionId],error:null});
}
}else if(obj.method == "mining.authorize"){
logger.log ( "New peer connected : " + obj.params[0]);
logger.log ( "New peer connected : " + chalk.blueBright(obj.params[0]));
this.name = obj.params[0];
if(this.ctrl.proxy.status != "ready"){
this.Error("Proxy not authorised yet");
Expand Down Expand Up @@ -110,7 +110,7 @@ Miner.prototype.Error = function(msg) {

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Miner.prototype.onEnd = function() {
logger.log ( "peer " + this.name + " disconnected");
logger.warn ( "peer " + chalk.blueBright(this.name) + " disconnected");
logger.dbg('[MINER<'+this.id+'>:DISCONNECTED] ');
this.ctrl.removeMiner(this.id);
logger.log ( this.ctrl.miners.size + " peer(s) mining on this proxy");
Expand Down
8 changes: 2 additions & 6 deletions lib/pool_connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ var PoolConnector = function(restartCallback){
this.onData = function(obj) {
logger.dbg('====================================')
logger.dbg('[POOL:IN] ' + JSON.stringify(obj));




if (this.status == 'subscribing' && (obj.id == 1)) { // Subscription (internal)
if(obj.error){
this.error(obj.error);
Expand Down Expand Up @@ -83,8 +79,8 @@ var PoolConnector = function(restartCallback){
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
this.onEnd = function() {
logger.log('Pool closed the connection... Restart proxy');
this.reconnect();
};
setTimeout( () => { restartCallback(); },1000);
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
this.send = function(obj){
logger.dbg('[POOL:OUT] ' + obj.method + ': ' + JSON.stringify(obj));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zecproxy",
"version": "1.0.1",
"version": "1.0.2",
"description": "Zcash Stratum Proxy",
"main": "proxy.js",
"scripts": {},
Expand Down

0 comments on commit 581580a

Please sign in to comment.