Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
df23dcc0bb
  1. 16
      iguana/iguana777.c
  2. 8
      iguana/iguana_init.c
  3. 3
      iguana/iguana_json.c
  4. 3
      iguana/iguana_unspents.c
  5. 24
      iguana/main.c

16
iguana/iguana777.c

@ -322,7 +322,7 @@ void iguana_balancesQ(struct iguana_info *coin,struct iguana_bundle *bp)
queue_enqueue("balancesQ",&balancesQ,&ptr->DL,0);
}
int32_t iguana_helpertask(FILE *fp,struct OS_memspace *mem,struct OS_memspace *memB,struct iguana_helper *ptr)
/*int32_t iguana_helpertask(FILE *fp,struct OS_memspace *mem,struct OS_memspace *memB,struct iguana_helper *ptr)
{
struct iguana_info *coin; struct iguana_peer *addr; struct iguana_bundle *bp,*nextbp;
addr = ptr->addr;
@ -358,18 +358,15 @@ int32_t iguana_helpertask(FILE *fp,struct OS_memspace *mem,struct OS_memspace *m
} else printf("no bundle in helperrequest\n");
} else printf("no coin in helperrequest\n");
return(0);
}
}*/
void iguana_helper(void *arg)
{
FILE *fp = 0; cJSON *argjson=0; int32_t type,helperid=rand(),flag,allcurrent,idle=0;
cJSON *argjson=0; int32_t type,helperid=rand(),flag,allcurrent,idle=0;
struct iguana_helper *ptr; struct iguana_info *coin; struct OS_memspace MEM,*MEMB; struct iguana_bundle *bp;
if ( arg != 0 && (argjson= cJSON_Parse(arg)) != 0 )
helperid = juint(argjson,"helperid");
type = (helperid % 2);
/*sprintf(fname,"%s/%s",GLOBALTMPDIR,helpername);
OS_compatible_path(fname);
fp = fopen(fname,"wb");*/
if ( argjson != 0 )
free_json(argjson);
printf("HELPER.%d started arg.(%s)\n",helperid,(char *)(arg!=0?arg:0));
@ -381,7 +378,7 @@ void iguana_helper(void *arg)
flag = 0;
allcurrent = 1;
//printf("helper.%d\n",helperid);
if ( ((ptr= queue_dequeue(&emitQ,0)) != 0 || (ptr= queue_dequeue(&helperQ,0)) != 0) )
/*if ( ((ptr= queue_dequeue(&emitQ,0)) != 0 || (ptr= queue_dequeue(&helperQ,0)) != 0) )
{
printf("unexpected emitQ or helperQ\n");
exit(-1);
@ -394,11 +391,12 @@ void iguana_helper(void *arg)
flag++;
}
myfree(ptr,ptr->allocsize);
}
}*/
if ( (helperid % IGUANA_NUMHELPERS) == (0 % IGUANA_NUMHELPERS) && (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
{
idle = 0;
if ( (bp= ptr->bp) != 0 && (coin= ptr->coin) != 0 && coin->active != 0 )
coin = ptr->coin;
if ( (bp= ptr->bp) != 0 && coin != 0 && coin->active != 0 )
{
coin->numbundlesQ--;
if ( coin->started != 0 )//&& time(NULL) >= bp->nexttime )

8
iguana/iguana_init.c

@ -313,11 +313,11 @@ void iguana_parseline(struct iguana_info *coin,int32_t iter,FILE *fp)
{
if ( (bp= coin->bundles[i]) != 0 && bp->queued == 0 )
{
//printf("%d ",i);
printf("%d ",i);
iguana_bundleQ(coin,bp,1000);
}
}
//printf("iguana_bundleQ\n");
printf("iguana_bundleQ\n");
}
}
}
@ -372,11 +372,9 @@ void iguana_blockspurge(struct iguana_info *coin)
void iguana_coinpurge(struct iguana_info *coin)
{
int32_t i; struct iguana_bundle *bp; char *hashstr; struct iguana_bundlereq *req; struct iguana_blockreq *breq; struct iguana_helper *ptr;
int32_t i; struct iguana_bundle *bp; char *hashstr; struct iguana_bundlereq *req; struct iguana_blockreq *breq;
coin->started = 0; coin->active = 0;
coin->RTgenesis = 0;
while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
myfree(ptr,ptr->allocsize);
if ( 1 )
{
while ( (hashstr= queue_dequeue(&coin->hdrsQ,1)) != 0 )

3
iguana/iguana_json.c

@ -623,9 +623,12 @@ STRING_ARG(iguana,startcoin,activecoin)
STRING_ARG(iguana,stopcoin,activecoin)
{
struct iguana_helper *ptr;
if ( coin != 0 )
{
coin->active = 0;
while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
myfree(ptr,ptr->allocsize);
iguana_coinpurge(coin);
return(clonestr("{\"result\":\"coin stopped\"}"));
} else return(clonestr("{\"error\":\"stopcoin needs coin\"}"));

3
iguana/iguana_unspents.c

@ -1411,6 +1411,9 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu
printf("error mapping bundle.[%d]\n",hdrsi);
}
char str[65]; printf("BALANCES WRITTEN for %d bundles %s\n",coin->balanceswritten,bits256_str(str,coin->balancehash));
struct iguana_helper *ptr;
while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
myfree(ptr,ptr->allocsize);
iguana_coinpurge(coin);
//exit(-1);
//coin->balanceswritten = iguana_volatileinit(coin);

24
iguana/main.c

@ -385,24 +385,20 @@ void mainloop(struct supernet_info *myinfo)
}
if ( (bp= coin->current) != 0 && coin->stucktime != 0 && coin->isRT == 0 && coin->RTheight == 0 && (time(NULL) - coin->stucktime) > coin->MAXSTUCKTIME )
{
if ( 0 && bp->emitfinish == 0 )
if ( 1 )
{
printf("%s is stuck too long, purging files for %d\n",coin->symbol,bp->hdrsi);
/*iguana_bundlepurgefiles(coin,bp);
for (j=0; j<bp->n; j++)
if ( (block= bp->blocks[j]) != 0 )
if ( coin->started != 0 )
{
struct iguana_helper *ptr;
while ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
myfree(ptr,ptr->allocsize);
iguana_coinpurge(coin);
while ( coin->started == 0 )
{
block->fpipbits = 0;
block->RO.recvlen = 0;
block->fpos = -1;
printf("wait for coin to reactivate\n");
sleep(1);
}
sleep(5);*/
while ( coin->started != 0 )
iguana_coinpurge(coin);
while ( coin->started == 0 )
{
printf("wait for coin to reactivate\n");
sleep(1);
}
}
}

Loading…
Cancel
Save