Skip to content

Commit

Permalink
Return html response for http requests to tcp mining ports
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Jun 29, 2014
1 parent d576cd6 commit 2080974
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion init.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ catch(e){
return;
}

config.version = "v0.99.0.4";
config.version = "v0.99.0.5";

require('./lib/logger.js');

Expand Down
12 changes: 10 additions & 2 deletions lib/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ function handleMinerMethod(method, params, ip, portData, sendReply, pushMessage)
}


var httpResponse = 'HTTP/1.1 200 OK\nContent-Type: text/plain\nContent-Length: 20\n\nmining server online';


function startPoolServerTcp(callback){
async.each(config.poolServer.ports, function(portData, cback){
var handleMessage = function(socket, jsonData, pushMessage){
Expand Down Expand Up @@ -596,8 +599,13 @@ function startPoolServerTcp(callback){
jsonData = JSON.parse(message);
}
catch(e){
log('warn', logSystem, 'Malformed message from %s: %s', [socket.remoteAddress, message]);
socket.destroy();
if (message.trim() === 'GET / HTTP/1.1'){
socket.end(httpResponse);
}
else {
log('warn', logSystem, 'Malformed message from %s: %s', [socket.remoteAddress, message]);
socket.destroy();
}
break;
}
handleMessage(socket, jsonData, pushMessage);
Expand Down

0 comments on commit 2080974

Please sign in to comment.