Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f8f7e11ab4
  1. 7
      iguana/iguana777.c
  2. 2
      iguana/iguana777.h
  3. 2
      iguana/iguana_bundles.c
  4. 6
      iguana/iguana_recv.c

7
iguana/iguana777.c

@ -368,8 +368,9 @@ void iguana_balancecalc(struct iguana_info *coin,struct iguana_bundle *bp)
void iguana_helper(void *arg) void iguana_helper(void *arg)
{ {
FILE *fp = 0; char fname[512],name[64],*helpername = 0; cJSON *argjson=0; int32_t flag,idle=0; FILE *fp = 0; char fname[512],name[64],*helpername = 0; cJSON *argjson=0; int32_t type,flag,idle=0;
struct iguana_helper *ptr; struct iguana_info *coin; struct OS_memspace MEM,*MEMB; struct iguana_helper *ptr; struct iguana_info *coin; struct OS_memspace MEM,*MEMB;
type = rand();
if ( arg != 0 && (argjson= cJSON_Parse(arg)) != 0 ) if ( arg != 0 && (argjson= cJSON_Parse(arg)) != 0 )
helpername = jstr(argjson,"name"); helpername = jstr(argjson,"name");
if ( helpername == 0 ) if ( helpername == 0 )
@ -388,7 +389,7 @@ void iguana_helper(void *arg)
{ {
//iguana_jsonQ(); //iguana_jsonQ();
flag = 0; flag = 0;
if ( (ptr= queue_dequeue(&emitQ,0)) != 0 || (ptr= queue_dequeue(&helperQ,0)) != 0 ) if ( (type % 2) == 0 && ((ptr= queue_dequeue(&emitQ,0)) != 0 || (ptr= queue_dequeue(&helperQ,0)) != 0) )
{ {
if ( ptr->bp != 0 && (coin= ptr->coin) != 0 ) if ( ptr->bp != 0 && (coin= ptr->coin) != 0 )
{ {
@ -400,7 +401,7 @@ void iguana_helper(void *arg)
} }
myfree(ptr,ptr->allocsize); myfree(ptr,ptr->allocsize);
} }
else if ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) else if ( (type % 2) == 1 && (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
{ {
idle = 0; idle = 0;
if ( ptr->bp != 0 && ptr->coin != 0 ) if ( ptr->bp != 0 && ptr->coin != 0 )

2
iguana/iguana777.h

@ -39,7 +39,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 3 #define _IGUANA_MAXPENDING 3
#define IGUANA_MINPENDBUNDLES 16 #define IGUANA_MINPENDBUNDLES 16
#define IGUANA_MAXPENDBUNDLES 64 #define IGUANA_MAXPENDBUNDLES 100
#define IGUANA_BUNDLELOOP 77 #define IGUANA_BUNDLELOOP 77
#define IGUANA_RPCPORT 7778 #define IGUANA_RPCPORT 7778
#define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16) #define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16)

2
iguana/iguana_bundles.c

@ -153,7 +153,7 @@ int32_t iguana_hash2set(struct iguana_info *coin,char *debugstr,struct iguana_bu
bit = iguana_calcbloom(newhash2); bit = iguana_calcbloom(newhash2);
if ( iguana_bloomfind(coin,&bp->bloom,0,bit) < 0 ) if ( iguana_bloomfind(coin,&bp->bloom,0,bit) < 0 )
{ {
//printf("bloomset (%s)\n",bits256_str(str,newhash2)); printf("bloomset (%s) -> [%d:%d]\n",bits256_str(str,newhash2),bp->hdrsi,bundlei);
iguana_bloomset(coin,&bp->bloom,0,bit); iguana_bloomset(coin,&bp->bloom,0,bit);
if ( 0 ) if ( 0 )
{ {

6
iguana/iguana_recv.c

@ -571,7 +571,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
//iguana_blockQ(coin,0,-1,blockhashes[1],0); //iguana_blockQ(coin,0,-1,blockhashes[1],0);
//iguana_blockQ(coin,0,-4,blockhashes[1],1); //iguana_blockQ(coin,0,-4,blockhashes[1],1);
char str[65]; char str[65];
if ( bp != 0 && num > 2 )//&& bp->hdrsi == coin->bundlescount-1 ) if ( num > 2 )//&& bp->hdrsi == coin->bundlescount-1 )
printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei); printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei);
if ( bp != 0 ) if ( bp != 0 )
{ {
@ -941,7 +941,7 @@ int32_t iguana_reqhdrs(struct iguana_info *coin)
int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65]; int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65];
if ( queue_size(&coin->hdrsQ) == 0 ) if ( queue_size(&coin->hdrsQ) == 0 )
{ {
if ( iguana_needhdrs(coin) > 0 ) //if ( iguana_needhdrs(coin) > 0 )
{ {
for (i=0; i<coin->bundlescount; i++) for (i=0; i<coin->bundlescount; i++)
{ {
@ -1066,7 +1066,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
} }
if ( bp == 0 || z != 0 ) if ( bp == 0 || z != 0 )
{ {
//printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0); printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0);
iguana_send(coin,addr,serialized,datalen); iguana_send(coin,addr,serialized,datalen);
addr->pendhdrs++; addr->pendhdrs++;
flag++; flag++;

Loading…
Cancel
Save