Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
eaa6f35173
  1. 10
      basilisk/basilisk.c
  2. 1
      basilisk/basilisk.h
  3. 2
      gecko/gecko.c

10
basilisk/basilisk.c

@ -679,7 +679,7 @@ INT_AND_ARRAY(basilisk,result,basilisktag,vals)
ptr->basilisktag = basilisktag;
strcpy(ptr->remoteaddr,remoteaddr);
safecopy(ptr->CMD,jstr(vals,"origcmd"),sizeof(ptr->CMD));
//printf("(%s) -> Q.%u results vals.(%s)\n",ptr->CMD,basilisktag,ptr->retstr);
printf("(%s) -> Q.%u results vals.(%s)\n",ptr->CMD,basilisktag,ptr->retstr);
queue_enqueue("resultsQ",&myinfo->basilisks.resultsQ,&ptr->DL,0);
return(clonestr("{\"result\":\"queued basilisk return\"}"));
} else printf("null vals.(%s) or no hexmsg.%p\n",jprint(vals,0),vals);
@ -800,6 +800,7 @@ void basilisks_loop(void *arg)
if ( (ptr= queue_dequeue(&myinfo->basilisks.submitQ,0)) != 0 )
{
HASH_ADD(hh,myinfo->basilisks.issued,basilisktag,sizeof(ptr->basilisktag),ptr);
ptr->refcount++;
continue;
}
//fprintf(stderr,"A");
@ -883,15 +884,18 @@ void basilisks_loop(void *arg)
if ( pending->dependents == 0 || pending->childrendone >= pending->numchildren )
{
HASH_DELETE(hh,myinfo->basilisks.issued,pending);
if ( --pending->refcount == 0 )
{
if ( pending->dependents != 0 )
free(pending->dependents);
fprintf(stderr,"HASH_DELETE free ptr.%u\n",pending->basilisktag);
fprintf(stderr,"HASH_DELETE free ptr.%u refcount.%d\n",pending->basilisktag,pending->refcount);
for (i=0; i<pending->numresults; i++)
if ( pending->results[i] != 0 )
free(pending->results[i]), pending->results[i] = 0;
if ( pending->vals != 0 )
free_json(pending->vals), pending->vals = 0;
free(pending);
//free(pending);
} else printf("illegal refcount for pending\n");
flag++;
}
}

1
basilisk/basilisk.h

@ -33,6 +33,7 @@ struct basilisk_item
{
struct queueitem DL; UT_hash_handle hh; struct basilisk_item *parent; void *dependents;
uint32_t submit,finished,basilisktag,numresults,numsent,numexact,uniqueflag,numrequired,childrendone,numchildren,nBits;
int32_t refcount;
char symbol[32],CMD[4],remoteaddr[64];
double expiration; cJSON *vals; int32_t metricdir; void *metricfunc;
char *retstr,*results[BASILISK_MAXFANOUT]; double metrics[BASILISK_MAXFANOUT];

2
gecko/gecko.c

@ -56,7 +56,7 @@ void gecko_iteration(struct supernet_info *myinfo,struct iguana_info *btcd,struc
virt->hdrstime = (uint32_t)time(NULL);
}
}
if ( btcd->RELAYNODE != 0 && virt->blocks.hwmchain.height >= virt->longestchain-1 )
if ( btcd->RELAYNODE != 0 && virt->blocks.hwmchain.height >= virt->longestchain-virt->chain->bundlesize )
{
bitcoin_address(mineraddr,virt->chain->pubtype,myinfo->persistent_pubkey33,33);
//fprintf(stderr,"mine.%s %s\n",virt->symbol,mineraddr);

Loading…
Cancel
Save