Browse Source

Use name for socket directory and add more config options

master
Con Kolivas 11 years ago
parent
commit
0d3d2434be
  1. 1
      src/bitcoin.c
  2. 21
      src/ckpool.c
  3. 2
      src/libckpool.h

1
src/bitcoin.c

@ -123,6 +123,7 @@ static bool gbt_merkle_bins(gbtbase_t *gbt, json_t *transaction_arr)
memcpy(gbt->txn_data + ofs, txn, len); memcpy(gbt->txn_data + ofs, txn, len);
ofs += len; ofs += len;
#if 0 #if 0
/* In case we ever want to be a gbt poolproxy */
if (!hash) { if (!hash) {
char *txn_bin; char *txn_bin;
int txn_len; int txn_len;

21
src/ckpool.c

@ -166,7 +166,7 @@ static void json_get_string(char **store, json_t *val, const char *res)
const char *buf; const char *buf;
*store = NULL; *store = NULL;
if (json_is_null(entry)) { if (!entry || json_is_null(entry)) {
LOGDEBUG("Json did not find entry %s", res); LOGDEBUG("Json did not find entry %s", res);
return; return;
} }
@ -193,6 +193,8 @@ static void parse_config(ckpool_t *ckp)
json_get_string(&ckp->btcdurl, json_conf, "btcdurl"); json_get_string(&ckp->btcdurl, json_conf, "btcdurl");
json_get_string(&ckp->btcdauth, json_conf, "btcdauth"); json_get_string(&ckp->btcdauth, json_conf, "btcdauth");
json_get_string(&ckp->btcdpass, json_conf, "btcdpass"); json_get_string(&ckp->btcdpass, json_conf, "btcdpass");
json_get_string(&ckp->btcaddress, json_conf, "btcaddress");
json_get_string(&ckp->btcsig, json_conf, "btcsig");
json_decref(json_conf); json_decref(json_conf);
} }
@ -223,8 +225,8 @@ int main(int argc, char **argv)
{ {
struct sigaction handler; struct sigaction handler;
pthread_t pth_listener; pthread_t pth_listener;
int len, c, ret;
ckpool_t ckp; ckpool_t ckp;
int c, ret;
global_ckp = &ckp; global_ckp = &ckp;
memset(&ckp, 0, sizeof(ckp)); memset(&ckp, 0, sizeof(ckp));
@ -247,11 +249,16 @@ int main(int argc, char **argv)
if (!ckp.name) if (!ckp.name)
ckp.name = strdup("ckpool"); ckp.name = strdup("ckpool");
if (!ckp.config) if (!ckp.config) {
ckp.config = strdup("ckpool.conf"); ckp.config = strdup(ckp.name);
if (!ckp.socket_dir) realloc_strcat(&ckp.config, ".conf");
ckp.socket_dir = strdup("/tmp/ckpool"); }
if (!ckp.socket_dir) {
ckp.socket_dir = strdup("/tmp/");
realloc_strcat(&ckp.socket_dir, ckp.name);
}
len = strlen(ckp.socket_dir);
if (memcmp(&ckp.socket_dir[len], "/", 1))
realloc_strcat(&ckp.socket_dir, "/"); realloc_strcat(&ckp.socket_dir, "/");
/* Ignore sigpipe */ /* Ignore sigpipe */

2
src/libckpool.h

@ -154,6 +154,8 @@ struct ckpool_instance {
char *btcdurl; char *btcdurl;
char *btcdauth; char *btcdauth;
char *btcdpass; char *btcdpass;
char *btcaddress;
char *btcsig;
}; };
void create_pthread(pthread_t *thread, void *(*start_routine)(void *), void *arg); void create_pthread(pthread_t *thread, void *(*start_routine)(void *), void *arg);

Loading…
Cancel
Save