|
|
@ -3,7 +3,7 @@ session_start(); |
|
|
|
# |
|
|
|
# |
|
|
|
global $doctype, $title, $miner, $port, $readonly, $notify, $rigs; |
|
|
|
global $doctype, $title, $miner, $port, $readonly, $notify, $rigs; |
|
|
|
global $mcast, $mcastexpect, $mcastaddr, $mcastport, $mcastcode; |
|
|
|
global $mcast, $mcastexpect, $mcastaddr, $mcastport, $mcastcode; |
|
|
|
global $mcastlistport, $mcasttimeout, $allowgen; |
|
|
|
global $mcastlistport, $mcasttimeout, $mcastretries, $allowgen; |
|
|
|
global $rigipsecurity, $rigtotals, $forcerigtotals; |
|
|
|
global $rigipsecurity, $rigtotals, $forcerigtotals; |
|
|
|
global $socksndtimeoutsec, $sockrcvtimeoutsec; |
|
|
|
global $socksndtimeoutsec, $sockrcvtimeoutsec; |
|
|
|
global $checklastshare, $poolinputs, $hidefields; |
|
|
|
global $checklastshare, $poolinputs, $hidefields; |
|
|
@ -70,6 +70,9 @@ $mcastlistport = 4027; |
|
|
|
# to wait for replies to the Multicast message |
|
|
|
# to wait for replies to the Multicast message |
|
|
|
$mcasttimeout = 1.5; |
|
|
|
$mcasttimeout = 1.5; |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
# Set $mcastretries to the number of times to retry the multicast |
|
|
|
|
|
|
|
$mcastretries = 0; |
|
|
|
|
|
|
|
# |
|
|
|
# Set $allowgen to true to allow customsummarypages to use 'gen' |
|
|
|
# Set $allowgen to true to allow customsummarypages to use 'gen' |
|
|
|
# false means ignore any 'gen' options |
|
|
|
# false means ignore any 'gen' options |
|
|
|
$allowgen = false; |
|
|
|
$allowgen = false; |
|
|
@ -373,10 +376,10 @@ global $haderror, $error; |
|
|
|
$haderror = false; |
|
|
|
$haderror = false; |
|
|
|
$error = null; |
|
|
|
$error = null; |
|
|
|
# |
|
|
|
# |
|
|
|
function getrigs() |
|
|
|
function mcastrigs() |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $rigs, $mcastaddr, $mcastport, $mcastcode; |
|
|
|
global $rigs, $mcastexpect, $mcastaddr, $mcastport, $mcastcode; |
|
|
|
global $mcastlistport, $mcasttimeout, $error; |
|
|
|
global $mcastlistport, $mcasttimeout, $mcastretries, $error; |
|
|
|
|
|
|
|
|
|
|
|
$listname = "0.0.0.0"; |
|
|
|
$listname = "0.0.0.0"; |
|
|
|
|
|
|
|
|
|
|
@ -414,6 +417,10 @@ function getrigs() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$retries = $mcastretries; |
|
|
|
|
|
|
|
$doretry = ($retries > 0); |
|
|
|
|
|
|
|
do |
|
|
|
|
|
|
|
{ |
|
|
|
$mcast_soc = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
|
|
|
$mcast_soc = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
|
|
|
if ($mcast_soc === false || $mcast_soc == null) |
|
|
|
if ($mcast_soc === false || $mcast_soc == null) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -451,9 +458,12 @@ function getrigs() |
|
|
|
$mdes = ''; |
|
|
|
$mdes = ''; |
|
|
|
|
|
|
|
|
|
|
|
if (strlen($mdes) > 0) |
|
|
|
if (strlen($mdes) > 0) |
|
|
|
$rigs[] = "$ip:$rp:$mdes"; |
|
|
|
$rig = "$ip:$rp:$mdes"; |
|
|
|
else |
|
|
|
else |
|
|
|
$rigs[] = "$ip:$rp"; |
|
|
|
$rig = "$ip:$rp"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!in_array($rig, $rigs)) |
|
|
|
|
|
|
|
$rigs[] = $rig; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ((microtime(true) - $stt) >= $mcasttimeout) |
|
|
|
if ((microtime(true) - $stt) >= $mcasttimeout) |
|
|
@ -461,9 +471,24 @@ function getrigs() |
|
|
|
|
|
|
|
|
|
|
|
usleep(100000); |
|
|
|
usleep(100000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($mcastexpect > 0 && count($rigs) >= $mcastexpect) |
|
|
|
|
|
|
|
$doretry = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} while ($doretry && --$retries > 0); |
|
|
|
|
|
|
|
|
|
|
|
socket_close($rep_soc); |
|
|
|
socket_close($rep_soc); |
|
|
|
} |
|
|
|
} |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
function getrigs() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
global $rigs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mcastrigs(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sort($rigs); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
# |
|
|
|
function getsock($rig, $addr, $port) |
|
|
|
function getsock($rig, $addr, $port) |
|
|
|
{ |
|
|
|
{ |
|
|
|
global $rigipsecurity; |
|
|
|
global $rigipsecurity; |
|
|
|