|
@ -267,9 +267,18 @@ void iguana_emitQ(struct iguana_info *coin,struct iguana_bundle *bp) |
|
|
|
|
|
|
|
|
void iguana_bundleQ(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit) |
|
|
void iguana_bundleQ(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit) |
|
|
{ |
|
|
{ |
|
|
struct iguana_helper *ptr; |
|
|
struct iguana_helper *ptr; struct iguana_bundle *tmp; int32_t i,n = 0; |
|
|
if ( 0 && bp->queued == 0 && bp->emitfinish <= 1 && iguana_bundleready(myinfo,coin,bp,0) == bp->n ) |
|
|
if ( 0 && bp->queued == 0 && bp->emitfinish <= 1 && iguana_bundleready(myinfo,coin,bp,0) == bp->n ) |
|
|
printf("bundle.[%d] is ready\n",bp->hdrsi); |
|
|
printf("bundle.[%d] is ready\n",bp->hdrsi); |
|
|
|
|
|
if ( bp->queued != 0 ) |
|
|
|
|
|
return; |
|
|
|
|
|
for (i=n=0; i<coin->bundlescount; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if ( (tmp= coin->bundles[i]) != 0 && tmp->queued != 0 ) |
|
|
|
|
|
n++; |
|
|
|
|
|
} |
|
|
|
|
|
if ( n < coin->MAXBUNDLES ) |
|
|
|
|
|
{ |
|
|
bp->queued = (uint32_t)time(NULL); |
|
|
bp->queued = (uint32_t)time(NULL); |
|
|
ptr = mycalloc('q',1,sizeof(*ptr)); |
|
|
ptr = mycalloc('q',1,sizeof(*ptr)); |
|
|
ptr->allocsize = sizeof(*ptr); |
|
|
ptr->allocsize = sizeof(*ptr); |
|
@ -279,10 +288,16 @@ void iguana_bundleQ(struct supernet_info *myinfo,struct iguana_info *coin,struct |
|
|
ptr->starttime = (uint32_t)time(NULL); |
|
|
ptr->starttime = (uint32_t)time(NULL); |
|
|
ptr->timelimit = timelimit; |
|
|
ptr->timelimit = timelimit; |
|
|
coin->numbundlesQ++; |
|
|
coin->numbundlesQ++; |
|
|
if ( 0 && bp->hdrsi > 170 ) |
|
|
//if ( 0 && bp->hdrsi > 170 )
|
|
|
printf("%s %p bundle.%d[%d] ht.%d emitfinish.%u\n",coin->symbol,bp,ptr->hdrsi,bp->n,bp->bundleheight,bp->emitfinish); |
|
|
printf("%s.%d %p bundle.%d[%d] ht.%d emitfinish.%u\n",coin->symbol,n,bp,ptr->hdrsi,bp->n,bp->bundleheight,bp->emitfinish); |
|
|
queue_enqueue("bundlesQ",&bundlesQ,&ptr->DL,0); |
|
|
queue_enqueue("bundlesQ",&bundlesQ,&ptr->DL,0); |
|
|
} |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
bp->queued = 0; |
|
|
|
|
|
//printf("MAXBUNDLES.%d reached.%d\n",coin->MAXBUNDLES,n);
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void iguana_validateQ(struct iguana_info *coin,struct iguana_bundle *bp) |
|
|
void iguana_validateQ(struct iguana_info *coin,struct iguana_bundle *bp) |
|
|
{ |
|
|
{ |
|
@ -691,7 +706,7 @@ void iguana_helper(void *arg) |
|
|
allcurrent = 0; |
|
|
allcurrent = 0; |
|
|
//printf("h.%d [%d] bundleQ size.%d lag.%ld\n",helperid,bp->hdrsi,queue_size(&bundlesQ),time(NULL) - bp->nexttime);
|
|
|
//printf("h.%d [%d] bundleQ size.%d lag.%ld\n",helperid,bp->hdrsi,queue_size(&bundlesQ),time(NULL) - bp->nexttime);
|
|
|
coin->numbundlesQ--; |
|
|
coin->numbundlesQ--; |
|
|
if ( coin->started != 0 && (bp->nexttime == 0 || time(NULL) >= bp->nexttime) && coin->active != 0 ) |
|
|
if ( coin->started != 0 && time(NULL) >= bp->nexttime && coin->active != 0 ) |
|
|
{ |
|
|
{ |
|
|
flag += iguana_bundleiters(myinfo,ptr->coin,&MEM,MEMB,bp,ptr->timelimit,IGUANA_DEFAULTLAG); |
|
|
flag += iguana_bundleiters(myinfo,ptr->coin,&MEM,MEMB,bp,ptr->timelimit,IGUANA_DEFAULTLAG); |
|
|
} |
|
|
} |
|
|