Browse Source

Merge pull request #389 from kanoi/bflsc

BFL stop 1st init command if no device + Update diff stale: total and pools when stratum throws away shares
nfactor-troky
Con Kolivas 12 years ago
parent
commit
52995e2811
  1. 10
      api.c
  2. 4
      cgminer.c
  3. 3
      driver-bitforce.c

10
api.c

@ -3433,12 +3433,10 @@ static void send_result(struct io_data *io_data, SOCKETTYPE c, bool isjson)
// ignore failure - it's closed immediately anyway // ignore failure - it's closed immediately anyway
n = send(c, buf, len+1, 0); n = send(c, buf, len+1, 0);
if (opt_debug) { if (SOCKETFAIL(n))
if (SOCKETFAIL(n)) applog(LOG_WARNING, "API: send failed: %s", SOCKERRMSG);
applog(LOG_DEBUG, "API: send failed: %s", SOCKERRMSG); else
else applog(LOG_DEBUG, "API: sent %d", n);
applog(LOG_DEBUG, "API: sent %d", n);
}
} }
static void tidyup(__maybe_unused void *arg) static void tidyup(__maybe_unused void *arg)

4
cgminer.c

@ -4702,12 +4702,14 @@ out:
void clear_stratum_shares(struct pool *pool) void clear_stratum_shares(struct pool *pool)
{ {
struct stratum_share *sshare, *tmpshare; struct stratum_share *sshare, *tmpshare;
double diff_cleared = 0;
int cleared = 0; int cleared = 0;
mutex_lock(&sshare_lock); mutex_lock(&sshare_lock);
HASH_ITER(hh, stratum_shares, sshare, tmpshare) { HASH_ITER(hh, stratum_shares, sshare, tmpshare) {
if (sshare->work->pool == pool) { if (sshare->work->pool == pool) {
HASH_DEL(stratum_shares, sshare); HASH_DEL(stratum_shares, sshare);
diff_cleared += sshare->work->work_difficulty;
free_work(sshare->work); free_work(sshare->work);
free(sshare); free(sshare);
cleared++; cleared++;
@ -4719,6 +4721,8 @@ void clear_stratum_shares(struct pool *pool)
applog(LOG_WARNING, "Lost %d shares due to stratum disconnect on pool %d", cleared, pool->pool_no); applog(LOG_WARNING, "Lost %d shares due to stratum disconnect on pool %d", cleared, pool->pool_no);
pool->stale_shares += cleared; pool->stale_shares += cleared;
total_stale += cleared; total_stale += cleared;
pool->diff_stale += diff_cleared;
total_diff_stale += diff_cleared;
} }
} }

3
driver-bitforce.c

@ -85,6 +85,9 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
if (lock) if (lock)
mutex_lock(&bitforce->device_mutex); mutex_lock(&bitforce->device_mutex);
if (bitforce->usbinfo.nodev)
goto failed;
// Reset // Reset
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET,
FTDI_VALUE_RESET, bitforce->usbdev->found->interface, C_RESET); FTDI_VALUE_RESET, bitforce->usbdev->found->interface, C_RESET);

Loading…
Cancel
Save