Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
6b88b20d29
  1. 2
      iguana/iguana777.c
  2. 2
      iguana/iguana_bundles.c
  3. 29
      iguana/iguana_peers.c
  4. 2
      iguana/main.c

2
iguana/iguana777.c

@ -425,6 +425,7 @@ void iguana_coinloop(void *arg)
{
if ( (coin= coins[i]) != 0 && coin->started == 0 )
{
iguana_rwiAddrind(coin,0,0,0);
iguana_coinstart(coin,coin->initialheight,coin->mapflags);
printf("init.(%s) maxpeers.%d maxrecvcache.%s services.%llx MAXMEM.%s polltimeout.%d cache.%d pend.(%d -> %d)\n",coin->symbol,coin->MAXPEERS,mbstr(str,coin->MAXRECVCACHE),(long long)coin->myservices,mbstr(str,coin->MAXMEM),coin->polltimeout,coin->enableCACHE,coin->startPEND,coin->endPEND);
coin->started = coin;
@ -432,7 +433,6 @@ void iguana_coinloop(void *arg)
}
}
coin = coins[0];
iguana_rwiAddrind(coin,0,0,0);
iguana_possible_peer(coin,"127.0.0.1");
memset(zero.bytes,0,sizeof(zero));
if ( (bp= iguana_bundlecreate(coin,&bundlei,0,*(bits256 *)coin->chain->genesis_hashdata,zero,1)) != 0 )

2
iguana/iguana_bundles.c

@ -636,7 +636,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32
{
if ( bits256_nonz(bp->hashes[i]) == 0 && bits256_nonz(bp->speculative[i]) != 0 )
{
if ( now > bp->issued[i]+60 )
if ( now > bp->issued[i]+20 )
{
bp->issued[i] = now;
//printf("speculative.[%d:%d]\n",bp->hdrsi,i);

29
iguana/iguana_peers.c

@ -68,7 +68,7 @@ struct iguana_iAddr *iguana_iAddrhashset(struct iguana_info *coin,struct iguana_
iA = tmp;
if ( ind <= 0 )
ind = coin->numiAddrs + 1;
//printf("coin->iAddrs.%p call set.(%x) ind.%d\n",coin->iAddrs,iA->ipbits,iA->ind);
printf("coin->iAddrs.%p call set.(%x) ind.%d\n",coin->iAddrs,(uint32_t)iA->ipbits,ind);
if ( (item= _iguana_hashset(coin,iA->ipbits,ind)) != 0 && item->hh.itemind == coin->numiAddrs+1 )
{
*item = *iA;
@ -138,14 +138,23 @@ uint32_t iguana_rwiAddrind(struct iguana_info *coin,int32_t rwflag,struct iguana
fseek(fp,m*sizeof(tmp),SEEK_SET);
fwrite(&tmp,1,sizeof(tmp),fp);
}
//printf("m.%d %x\n",m,tmp.ipbits);
//printf("rwiAddrind m.%d %x\n",m,(uint32_t)tmp.ipbits);
m++;
coin->numiAddrs = m;
expand_ipbits(hexstr,tmp.ipbits);
iguana_possible_peer(coin,hexstr);
}
else
{
expand_ipbits(hexstr,tmp.ipbits);
printf("status.%d ipbits.%x\n",tmp.status,(uint32_t)tmp.ipbits);
tmp.status = 0;
fseek(fp,i * sizeof(tmp),SEEK_SET);
if ( fwrite(&tmp,1,sizeof(tmp),fp) != sizeof(tmp) )
printf("error writing peer.%d\n",i);
}
portable_mutex_unlock(&coin->peers_mutex);
}
} else printf("skip.%d ipbits.%x\n",i,(uint32_t)tmp.ipbits);
}
fclose(fp);
printf("i.%d m.%d numiAddrs.%d\n",i,m,coin->numiAddrs);
@ -180,6 +189,8 @@ uint32_t iguana_rwiAddrind(struct iguana_info *coin,int32_t rwflag,struct iguana
fp = fopen(fname,"wb");
if ( fp != 0 )
{
if ( ind <= 0 )
ind = coin->numiAddrs++;
fseek(fp,ind * sizeof(*iA),SEEK_SET);
if ( ftell(fp) == ind * sizeof(*iA) )
{
@ -191,7 +202,7 @@ uint32_t iguana_rwiAddrind(struct iguana_info *coin,int32_t rwflag,struct iguana
if ( (iA= iguana_iAddrhashset(coin,iA,ind)) != 0 )
{
retval = iA->hh.itemind+1;
//printf("W %p ipbits.%x ind.%d saved iA->ind.%d retval.%d\n",iA,iA->ipbits,ind,iA->hh. itemind,retval);
printf("W %p ipbits.%x ind.%d saved iA->ind.%d retval.%d\n",iA,(uint32_t)iA->ipbits,ind,iA->hh. itemind,retval);
}
}
} else printf("iAddr: error seeking.[%d] %ld vs %ld\n",ind,ftell(fp),ind * sizeof(*iA));
@ -247,8 +258,8 @@ void iguana_iAkill(struct iguana_info *coin,struct iguana_peer *addr,int32_t mar
} else printf("killconnection cant get ind for ipaddr.%s\n",addr->ipaddr);
memset(addr,0,sizeof(*addr));
addr->usock = -1;
if ( rank > 0 )
iguana_possible_peer(coin,ipaddr);
//if ( rank > 0 )
// iguana_possible_peer(coin,ipaddr);
}
int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port)
@ -688,9 +699,9 @@ void *iguana_iAddriterator(struct iguana_info *coin,struct iguana_iAddr *iA)
{
//printf("%x\n",iA->ipbits);
//portable_mutex_unlock(&coin->peers_mutex);
if ( (addr= iguana_peerslot(coin,iA->ipbits,0)) != 0 )//i < coin->MAXPEERS && i < IGUANA_MAXPEERS && addr != 0 )
if ( (addr= iguana_peerslot(coin,iA->ipbits,0)) != 0 )
{
//printf("pend.%d status.%d possible peer.(%s).%x threads %d %d %d %d\n",addr->pending,iA->status,addr->ipaddr,addr->ipbits,iguana_numthreads(coin,0),iguana_numthreads(coin,1),iguana_numthreads(coin,2),iguana_numthreads(coin,3));
printf("pend.%d status.%d possible peer.(%s).%x threads %d %d %d %d\n",addr->pending,iA->status,addr->ipaddr,(uint32_t)addr->ipbits,iguana_numthreads(coin,0),iguana_numthreads(coin,1),iguana_numthreads(coin,2),iguana_numthreads(coin,3));
if ( addr->pending == 0 && iA->status != IGUANA_PEER_CONNECTING )
{
if ( iguana_rwiAddrind(coin,1,iA,iA->hh.itemind) > 0 )
@ -734,7 +745,7 @@ uint32_t iguana_possible_peer(struct iguana_info *coin,char *ipaddr)
return((uint32_t)time(NULL));
}
#endif
//printf("check possible peer.(%s)\n",ipaddr);
printf("check possible peer.(%s)\n",ipaddr);
for (i=n=0; i<coin->MAXPEERS; i++)
{
if ( strcmp(ipaddr,coin->peers.active[i].ipaddr) == 0 )

2
iguana/main.c

@ -1128,7 +1128,7 @@ void iguana_main(void *arg)
sleep(1);
char *str;
//iguana_launchcoin(MYINFO.rpcsymbol,cJSON_Parse("{}"));
if ( 1 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"startpend\":512,\"endpend\":512,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":129,\"maxpeers\":128,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":1}"),0)) != 0 )
if ( 1 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"startpend\":512,\"endpend\":512,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":129,\"maxpeers\":128,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":4,\"poll\":1}"),0)) != 0 )
{
free(str);
if ( 0 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":1024,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1}"),0)) != 0 )

Loading…
Cancel
Save