Browse Source

Merge branch 'master' into multiproxy

master
Con Kolivas 10 years ago
parent
commit
83f99bdb75
  1. 19
      pool/page.php
  2. 2
      pool/prime.php
  3. 2
      src/ckpool.c
  4. 4
      src/ckpool.h
  5. 18
      src/stratifier.c

19
pool/page.php

@ -205,8 +205,8 @@ function ni(e,o){if(e){if(o==0){e.defd=e.style.display;e.style.display='none'}el
function domin(o){var e=document.getElementById('minicb');if(e){if(o==0){e.checked=true}else{e.checked=false}};for(var i=0;i<10;i++){e=document.getElementById('mini'+i);ni(e,o)}}
function mini(){var hm=gcn('mini');if(hm==''){domin(1)}else{domin(0)}}
function md(e){var c='';if(e.checked){c='y'}scnv('mini',c);mini()}
function tim(){var e=document.getElementById('ftr');if(e){var now=new Date(),t=document.createTextNode(now.toLocaleString());e.appendChild(t)}}
function jst(){var e=document.getElementById('jst');if(e){e.style.visibility='hidden'}}
window.onpaint=jst();
</script>\n";
$head .= "<style type='text/css'>
input[type=checkbox] {vertical-align: -2px;}
@ -245,7 +245,7 @@ if (!$iCrap)
}
$head .= "
h1 {margin-top: 20px; float:middle; font-size: 20px;}
.foot, .push {height: 50px; font-size: 10pt;}
.foot, .push {height: 50px;}
.title {background-color: #909090;}
.even {background-color: #cccccc;}
.odd {background-color: #a8a8a8;}
@ -263,6 +263,9 @@ h1 {margin-top: 20px; float:middle; font-size: 20px;}
.fthi {color:red; font-size:7px; }
.ftlo {color:green; font-size:7px; }
.ft {color:blue; font-size:7px; }
.ftl {text-align: left; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap; }
.ftm {text-align: middle; font-size:10pt; display:inline-block; width:60%; white-space: nowrap; }
.ftr {text-align: rigth; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap; }
$css_marker
</style>\n";
@ -589,7 +592,7 @@ function pgmenu($menus)
#
function pgbody($info, $page, $menu, $dotop, $user, $douser)
{
$body = '<body onload="mini();jst()"';
$body = '<body';
if ($page == 'index')
$body .= ' background=/BTC20.png';
$body .= '><div class=page>';
@ -613,12 +616,14 @@ function pgbody($info, $page, $menu, $dotop, $user, $douser)
#
function pgfoot($info)
{
global $stt;
$foot = '</div></td></tr>';
$foot .= '</table>';
$foot .= '</center></td></tr>';
$foot .= '</table>';
$foot .= '<div class=push></div></div>';
$foot .= '<div class=foot><br>';
$std = gmdate('jS M H:i:s \U\T\C', intval($stt));
$foot .= "<div class=foot><br><span class=ftl>$std&nbsp;</span><span class=ftm>";
if (is_array($info) && isset($info['sync']))
{
$sync = $info['sync'];
@ -627,14 +632,14 @@ function pgfoot($info)
else
$syc = 'lo';
$syncd = number_format($sync);
$foot .= "<span class=ft$syc>sync: $syncd</span> ";
$foot .= "<span class=ft$syc>sync: $syncd</span>&nbsp;";
}
$foot .= 'Copyright &copy; Kano 2014';
$now = date('Y');
if ($now != '2014')
$foot .= "-$now";
$foot .= ' <span class=ft>Z/s</span></div>';
$foot .= "</body></html>\n";
$foot .= '&nbsp;<span class=ft>Z/s</span></span><span class=ftr id=ftr>&nbsp;</span></div>';
$foot .= "<script type='text/javascript'>jst();tim();mini();</script></body></html>\n";
return $foot;
}

2
pool/prime.php

@ -1,7 +1,7 @@
<?php
#
global $stt;
$stt = microtime();
$stt = microtime(true);
#
global $loginfailed;
$loginfailed = false;

2
src/ckpool.c

@ -1438,6 +1438,8 @@ int main(int argc, char **argv)
global_ckp = &ckp;
memset(&ckp, 0, sizeof(ckp));
ckp.starttime = time(NULL);
ckp.startpid = getpid();
ckp.loglevel = LOG_NOTICE;
ckp.initial_args = ckalloc(sizeof(char *) * (argc + 2)); /* Leave room for extra -H */
for (ckp.args = 0; ckp.args < argc; ckp.args++)

4
src/ckpool.h

@ -99,6 +99,10 @@ struct server_instance {
typedef struct server_instance server_instance_t;
struct ckpool_instance {
/* Start time */
time_t starttime;
/* Start pid */
pid_t startpid;
/* The initial command line arguments */
char **initial_args;
/* Number of arguments */

18
src/stratifier.c

@ -401,9 +401,9 @@ struct stratifier_data {
/* Protects sequence numbers */
mutex_t ckdb_msg_lock;
/* Incrementing global sequence number */
int ckdb_seq;
uint64_t ckdb_seq;
/* Incrementing ckdb_ids[] sequence numbers */
int ckdb_seq_ids[ID_COUNT];
uint64_t ckdb_seq_ids[ID_COUNT];
bool ckdb_offline;
bool verbose;
@ -682,17 +682,21 @@ static char *ckdb_msg(ckpool_t *ckp, sdata_t *sdata, json_t *val, const int idty
char *json_msg;
char logname[512];
char *ret = NULL;
uint64_t seqall;
/* Set the atomically incrementing sequence number */
json_set_int(val, "seqstart", ckp->starttime);
json_set_int(val, "seqpid", ckp->startpid);
/* Set the atomically incrementing sequence numbers */
mutex_lock(&sdata->ckdb_msg_lock);
json_set_int(val, "seqall", sdata->ckdb_seq++);
seqall = sdata->ckdb_seq++;
json_set_int(val, "seqall", seqall);
json_set_int(val, ckdb_seq_names[idtype], sdata->ckdb_seq_ids[idtype]++);
mutex_unlock(&sdata->ckdb_msg_lock);
json_msg = json_dumps(val, JSON_COMPACT);
if (unlikely(!json_msg))
goto out;
ASPRINTF(&ret, "%s.id.json=%s", ckdb_ids[idtype], json_msg);
ASPRINTF(&ret, "%s.%"PRIu64".json=%s", ckdb_ids[idtype], seqall, json_msg);
free(json_msg);
out:
json_decref(val);
@ -3815,7 +3819,7 @@ static int send_recv_auth(stratum_instance_t *client)
LOGINFO("Got ckdb response: %s", buf);
response = alloca(responselen);
memset(response, 0, responselen);
if (unlikely(sscanf(buf, "id.%*d.%c%n", response, &offset) < 1)) {
if (unlikely(sscanf(buf, "%*d.%*d.%c%n", response, &offset) < 1)) {
LOGWARNING("Got1 unparseable ckdb auth response: %s", buf);
goto out_fail;
}
@ -5248,7 +5252,7 @@ static void ckdbq_process(ckpool_t *ckp, char *msg)
int offset = 0;
memset(response, 0, responselen);
if (sscanf(buf, "id.%*d.%c%n", response, &offset) > 0) {
if (sscanf(buf, "%*d.%*d.%c%n", response, &offset) > 0) {
strcpy(response+1, buf+offset);
if (safecmp(response, "ok")) {
char *cmd;

Loading…
Cancel
Save