Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
a02e289af0
  1. 9
      iguana/iguana_bundles.c
  2. 11
      iguana/iguana_recv.c

9
iguana/iguana_bundles.c

@ -562,7 +562,12 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit)
{
int32_t i,n; uint32_t now; struct iguana_block *block; double endmillis = OS_milliseconds() + timelimit;
int32_t i,n,pend; uint32_t now; struct iguana_block *block; double endmillis;
for (i=pend=0; i<IGUANA_MAXPEERS; i++)
pend += coin->peers.active[i].pendblocks;
if ( pend >= coin->MAXPENDING*coin->MAXPEERS )
return;
endmillis = OS_milliseconds() + timelimit;
printf("ITERATE bundle.%d n.%d r.%d s.%d finished.%d\n",bp->bundleheight,bp->n,bp->numrecv,bp->numsaved,bp->emitfinish);
memset(bp->issued,0,sizeof(bp->issued));
while ( bp->emitfinish == 0 && OS_milliseconds() < endmillis )
@ -575,7 +580,7 @@ void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_
if ( block->queued == 0 && block->fpipbits == 0 && bp->issued[i] == 0 )
{
//printf("(%d:%d) ",bp->hdrsi,i);
iguana_blockQ(coin,bp,i,block->RO.hash2,0);
iguana_blockQ(coin,bp,i,block->RO.hash2,bp->numsaved > bp->n-10);
bp->issued[i] = now;
}
else if ( block->fpipbits != 0 )

11
iguana/iguana_recv.c

@ -310,7 +310,7 @@ uint32_t iguana_allhashcmp(struct iguana_info *coin,struct iguana_bundle *bp,bit
}
//printf("ALLHASHES FOUND! %d requested.%d\n",bp->bundleheight,n);
bp->queued = (uint32_t)time(NULL);
iguana_bundleQ(coin,bp,1000);
iguana_bundleQ(coin,bp,5000);
return(bp->queued);
}
}
@ -685,8 +685,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
{
uint8_t serialized[sizeof(struct iguana_msghdr) + sizeof(uint32_t)*32 + sizeof(bits256)];
char *hashstr=0; bits256 hash2; uint32_t now; struct iguana_block *block; struct iguana_blockreq *req=0;
int32_t m,z; struct iguana_bundle *bp;
int32_t limit,height=-1,bundlei,datalen,flag = 0;
struct iguana_bundle *bp; struct iguana_peer *ptr; int32_t i,m,z,pend,limit,height=-1,bundlei,datalen,flag = 0;
if ( addr->msgcounts.verack == 0 )
return(0);
now = (uint32_t)time(NULL);
@ -740,6 +739,12 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
if ( addr->rank != 1 && req == 0 && addr->pendblocks < limit )
{
priority = 0;
for (i=m=pend=0; i<coin->peers.numranked; i++)
{
if ( (ptr= coin->peers.ranked[i]) != 0 && ptr->msgcounts.verack > 0 )
pend += ptr->pendblocks, m++;
}
if ( pend < _IGUANA_MAXPENDING*m )
req = queue_dequeue(&coin->blocksQ,0);
} else priority = 1;
if ( req != 0 )

Loading…
Cancel
Save