Browse Source

ckdb - change the longpoll abbreviation lp used, to the actual meaning: block change, but using the abbreviation bc

master
kanoi 11 years ago
parent
commit
eb1977213c
  1. 6
      pool/page.php
  2. 18
      src/ckdb.c

6
pool/page.php

@ -173,12 +173,12 @@ function pgtop($dotop, $user, $douser)
}
}
if (isset($info['lastlp']))
if (isset($info['lastbc']))
{
$nlb = $info['lastlp'];
$nlb = $info['lastbc'];
if ($nlb != '?')
{
$sec = $now - $info['lastlp'];
$sec = $now - $info['lastbc'];
$min = round($sec / 60);
$nlb = $min.'m';
$s = $sec % 60;

18
src/ckdb.c

@ -655,7 +655,7 @@ static K_STORE *workinfo_store;
static K_ITEM *workinfo_current;
// first workinfo of current block
// TODO: have it's own memory?
static tv_t *last_lp;
static tv_t *last_bc;
// SHARES id.sharelog.json={...}
typedef struct shares {
@ -2339,11 +2339,11 @@ unparam:
workinfo_root = add_to_ktree(workinfo_root, item, cmp_workinfo);
k_add_head(workinfo_store, item);
// Remember the lp 'now' when the height changes
// Remember the bc 'now' when the height changes
if (workinfo_current) {
if (cmp_height(DATA_WORKINFO(workinfo_current)->coinbase1,
DATA_WORKINFO(item)->coinbase1) != 0)
last_lp = &(DATA_WORKINFO(item)->createdate);
last_bc = &(DATA_WORKINFO(item)->createdate);
}
workinfo_current = item;
@ -3307,7 +3307,7 @@ static void setup_data()
// Find the first workinfo for this height
found = find_after_in_ktree(workinfo_height_root, &look, cmp_workinfo_height, ctx);
if (found)
last_lp = &(DATA_WORKINFO(found)->createdate);
last_bc = &(DATA_WORKINFO(found)->createdate);
// No longer needed
workinfo_height_root = free_ktree(workinfo_height_root, NULL);
}
@ -3934,17 +3934,17 @@ static char *cmd_homepage(char *cmd, char *id, __maybe_unused tv_t *now, __maybe
strcpy(buf, "ok.");
off = strlen(buf);
if (last_lp) {
tvs_to_buf(last_lp, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "lastlp=%s%c", reply, FLDSEP);
if (last_bc) {
tvs_to_buf(last_bc, reply, sizeof(reply));
snprintf(tmp, sizeof(tmp), "lastbc=%s%c", reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
} else {
snprintf(tmp, sizeof(tmp), "lastlp=?%c", FLDSEP);
snprintf(tmp, sizeof(tmp), "lastbc=?%c", FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}
/*
// TODO: have a last_block - like last_lp - only updated when we find a block
// TODO: have a last_block - like last_bc - only updated when we find a block
b_item = last_in_tree(blocks_root, ctx);
if (b_item) {
tvs_to_buf(&(DATA_BLOCKS(b_item)->createdate), reply, sizeof(reply));

Loading…
Cancel
Save