Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
b7eb11ef89
  1. 2
      iguana/iguana777.h
  2. 2
      iguana/iguana_peers.c
  3. 35
      iguana/iguana_recv.c

2
iguana/iguana777.h

@ -33,7 +33,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_HEIGHT 200 #define IGUANA_HEIGHT 200
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 3 //64 #define _IGUANA_MAXPENDING 64 //64
#define _IGUANA_MAXBUNDLES 8 #define _IGUANA_MAXBUNDLES 8
#define IGUANA_BUNDLELOOP 100 #define IGUANA_BUNDLELOOP 100
#define IGUANA_RPCPORT 7778 #define IGUANA_RPCPORT 7778

2
iguana/iguana_peers.c

@ -1035,7 +1035,7 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr)
} }
else if ( addr->rank != 1 ) else if ( addr->rank != 1 )
usleep(coin->polltimeout*100 + 1*(rand() % (coin->polltimeout*100))); usleep(coin->polltimeout*100 + 1*(rand() % (coin->polltimeout*100)));
else usleep(100); else usleep(1000);
} else run >>= 2; } else run >>= 2;
} }
if ( flag != 0 ) if ( flag != 0 )

35
iguana/iguana_recv.c

@ -888,24 +888,19 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
block = 0; block = 0;
if ( priority == 0 && (bp= req->bp) != 0 && req->bundlei >= 0 && req->bundlei < bp->n && req->bundlei < coin->chain->bundlesize && (block= bp->blocks[req->bundlei]) != 0 && (block->fpipbits != 0 || block->queued != 0) ) if ( priority == 0 && (bp= req->bp) != 0 && req->bundlei >= 0 && req->bundlei < bp->n && req->bundlei < coin->chain->bundlesize && (block= bp->blocks[req->bundlei]) != 0 && (block->fpipbits != 0 || block->queued != 0) )
{ {
//if ( 1 && priority != 0 ) if ( 1 && priority != 0 )
printf("SKIP %p[%d] %d\n",bp,bp!=0?bp->bundleheight:-1,req->bundlei); printf("SKIP %p[%d] %d\n",bp,bp!=0?bp->bundleheight:-1,req->bundlei);
} }
else else
{ {
if ( block != 0 ) if ( block != 0 )
{
//char str[65];
//if ( 0 && priority != 0 )
//printf(" issue.%s req.%d\n",bits256_str(str,hash2),block->numrequests);
block->numrequests++; block->numrequests++;
}
iguana_sendblockreqPT(coin,addr,req->bp,req->bundlei,hash2,0); iguana_sendblockreqPT(coin,addr,req->bp,req->bundlei,hash2,0);
} }
flag++; flag++;
myfree(req,sizeof(*req)); myfree(req,sizeof(*req));
} }
else if ( addr->rank > 1 ) else if ( addr->rank > 0 )
{ {
struct iguana_block *bestblock = 0; struct iguana_bundle *bestbp = 0; int32_t besti = -1; struct iguana_block *bestblock = 0; struct iguana_bundle *bestbp = 0; int32_t besti = -1;
n = coin->peers.numranked * 2; n = coin->peers.numranked * 2;
@ -943,18 +938,18 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
printf("near hwm.%d gap.%d peer.%s bpranked.%d [%d:%d] pending.%d numreqs.%d\n",coin->blocks.hwmchain.height,gap,addr->ipaddr,bestbp->rank,bestbp->hdrsi,besti,addr->pendblocks,bestblock->numrequests); printf("near hwm.%d gap.%d peer.%s bpranked.%d [%d:%d] pending.%d numreqs.%d\n",coin->blocks.hwmchain.height,gap,addr->ipaddr,bestbp->rank,bestbp->hdrsi,besti,addr->pendblocks,bestblock->numrequests);
bestblock->numrequests++; bestblock->numrequests++;
iguana_sendblockreqPT(coin,addr,bestbp,besti,bestblock->RO.hash2,1); iguana_sendblockreqPT(coin,addr,bestbp,besti,bestblock->RO.hash2,1);
} //else printf("addr.%s nothing near to do\n",addr->ipaddr); }
} else if ( (bp= addr->bp) != 0 && bp->rank != 0 && addr->pendblocks < limit )
if ( (bp= addr->bp) != 0 && bp->rank != 0 && addr->pendblocks < limit ) {
{ for (i=0; i<bp->n; i++)
for (i=0; i<bp->n; i++) if ( (block= bp->blocks[i]) != 0 && block->numrequests == bp->minrequests && block->fpipbits == 0 && block->queued == 0 )
if ( (block= bp->blocks[i]) != 0 && block->numrequests == bp->minrequests && block->fpipbits == 0 && block->queued == 0 ) {
{ printf("peer.%s ranked.%d [%d:%d] pending.%d numreqs.%d\n",addr->ipaddr,bp->rank,bp->hdrsi,i,addr->pendblocks,block->numrequests);
printf("peer.%s ranked.%d [%d:%d] pending.%d\n",addr->ipaddr,bp->rank,bp->hdrsi,i,addr->pendblocks); block->numrequests++;
block->numrequests++; iguana_sendblockreqPT(coin,addr,bp,i,block->RO.hash2,1);
iguana_sendblockreqPT(coin,addr,bp,i,block->RO.hash2,1); break;
break; }
} }
} }
return(flag); return(flag);
} }

Loading…
Cancel
Save