Skip to content

Commit

Permalink
Prevent EventEmitter memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasjones committed May 23, 2014
1 parent e1980db commit a8f9cf6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ function startPoolServerTcp(callback){
}

var sendReply = function(error, result){
if(!socket.writable) return;
var sendData = JSON.stringify({
id: jsonData.id,
jsonrpc: "2.0",
Expand All @@ -593,10 +594,6 @@ function startPoolServerTcp(callback){
socket.write(sendData);
};

socket.on('close', function() {
sendReply = function(){};
});

handleMinerMethod(jsonData.method, jsonData.params, socket.remoteAddress, portData, sendReply, pushMessage);
};

Expand All @@ -607,6 +604,7 @@ function startPoolServerTcp(callback){
var dataBuffer = '';

var pushMessage = function(method, params){
if(!socket.writable) return;
var sendData = JSON.stringify({
jsonrpc: "2.0",
method: method,
Expand Down

0 comments on commit a8f9cf6

Please sign in to comment.