diff --git a/src/connector.c b/src/connector.c index 668917d5..d91755da 100644 --- a/src/connector.c +++ b/src/connector.c @@ -136,7 +136,7 @@ retry: ck_wlock(&ci->lock); client->id = client_id++; - HASH_ADD_INT(clients, id, client); + HASH_ADD_I64(clients, id, client); HASH_REPLACE(fdhh, fdclients, fd, SOI, client, old_client); ci->nfds++; ck_wunlock(&ci->lock); @@ -441,16 +441,16 @@ static void send_client(conn_instance_t *ci, int64_t id, char *buf) } ck_rlock(&ci->lock); - HASH_FIND_INT(clients, &id, client); + HASH_FIND_I64(clients, &id, client); if (likely(client)) fd = client->fd; ck_runlock(&ci->lock); if (unlikely(fd == -1)) { if (client) - LOGINFO("Client id %d disconnected", id); + LOGINFO("Client id %ld disconnected", id); else - LOGINFO("Connector failed to find client id %d to send to", id); + LOGINFO("Connector failed to find client id %ld to send to", id); free(buf); return; } @@ -471,7 +471,7 @@ static client_instance_t *client_by_id(conn_instance_t *ci, int64_t id) client_instance_t *client; ck_rlock(&ci->lock); - HASH_FIND_INT(clients, &id, client); + HASH_FIND_I64(clients, &id, client); ck_runlock(&ci->lock); return client; diff --git a/src/stratifier.c b/src/stratifier.c index ee184f3d..2c57f24f 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -550,7 +550,7 @@ static void add_base(ckpool_t *ckp, workbase_t *wb, bool *new_block) break; } } - HASH_ADD_INT(workbases, id, wb); + HASH_ADD_I64(workbases, id, wb); current_workbase = wb; ck_wunlock(&workbase_lock); @@ -798,7 +798,7 @@ static stratum_instance_t *__instance_by_id(int64_t id) { stratum_instance_t *instance; - HASH_FIND_INT(stratum_instances, &id, instance); + HASH_FIND_I64(stratum_instances, &id, instance); return instance; } @@ -812,7 +812,7 @@ static stratum_instance_t *__stratum_add_instance(ckpool_t *ckp, int64_t id) instance->ckp = ckp; tv_time(&instance->ldc); LOGINFO("Added instance %d", id); - HASH_ADD_INT(stratum_instances, id, instance); + HASH_ADD_I64(stratum_instances, id, instance); return instance; } @@ -1214,10 +1214,10 @@ static json_t *parse_subscribe(int64_t client_id, json_t *params_val) if (!old_match) { /* Create a new extranonce1 based on a uint64_t pointer */ new_enonce1(client); - LOGINFO("Set new subscription %d to new enonce1 %s", client->id, + LOGINFO("Set new subscription %ld to new enonce1 %s", client->id, client->enonce1); } else { - LOGINFO("Set new subscription %d to old matched enonce1 %s", client->id, + LOGINFO("Set new subscription %ld to old matched enonce1 %s", client->id, client->enonce1); } @@ -1353,7 +1353,7 @@ static json_t *parse_authorise(stratum_instance_t *client, json_t *params_val, j client->start_time = now.tv_sec; strcpy(client->address, address); - LOGNOTICE("Authorised client %d worker %s as user %s", client->id, buf, + LOGNOTICE("Authorised client %ld worker %s as user %s", client->id, buf, client->user_instance->username); client->workername = strdup(buf); if (client->ckp->standalone) @@ -1746,7 +1746,7 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg, share = true; ck_rlock(&workbase_lock); - HASH_FIND_INT(workbases, &id, wb); + HASH_FIND_I64(workbases, &id, wb); if (unlikely(!wb)) { err = SE_INVALID_JOBID; json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); diff --git a/src/uthash.h b/src/uthash.h index 72acf117..10c9b6b7 100644 --- a/src/uthash.h +++ b/src/uthash.h @@ -261,6 +261,10 @@ do { HASH_ADD(hh,head,intfield,sizeof(int),add) #define HASH_REPLACE_INT(head,intfield,add,replaced) \ HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced) +#define HASH_FIND_I64(head,findint,out) \ + HASH_FIND(hh,head,findint,sizeof(int64_t),out) +#define HASH_ADD_I64(head,intfield,add) \ + HASH_ADD(hh,head,intfield,sizeof(int64_t),add) #define HASH_FIND_PTR(head,findptr,out) \ HASH_FIND(hh,head,findptr,sizeof(void *),out) #define HASH_ADD_PTR(head,ptrfield,add) \