Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
a40ea7b1de
  1. 2
      iguana/iguana777.c
  2. 3
      iguana/iguana_bundles.c
  3. 15
      iguana/iguana_peers.c
  4. 5
      iguana/iguana_recv.c

2
iguana/iguana777.c

@ -310,6 +310,8 @@ int32_t iguana_helpertask(FILE *fp,struct OS_memspace *mem,struct OS_memspace *m
{
if ( (bp= ptr->bp) != 0 )
{
if ( time(NULL) > bp->nexttime )
return(0);
if ( 0 && ptr->type == 'M' )
{
if ( (nextbp= ptr->nextbp) != 0 )

3
iguana/iguana_bundles.c

@ -391,6 +391,8 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
}
for (i=counter=0; i<bp->n; i++)
{
if ( bp != coin->current )
break;
if ( (block= bp->blocks[i]) != 0 )
{
if ( block->fpipbits == 0 || block->RO.recvlen == 0 )
@ -398,6 +400,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int
if ( block->issued == 0 || now > block->issued+60 )
{
block->numrequests++;
printf("kick [%d:%d]\n",bp->hdrsi,i);
iguana_blockQ("kick",coin,bp,i,block->RO.hash2,0);
bp->issued[i] = block->issued = now;
counter++;

15
iguana/iguana_peers.c

@ -595,7 +595,7 @@ void iguana_startconnection(void *arg)
printf("avoid self-loopback\n");
return;
}
//printf("startconnection.(%s) pending.%u usock.%d addrind.%d\n",addr->ipaddr,addr->pending,addr->usock,addr->addrind);
printf("startconnection.(%s) pending.%u usock.%d addrind.%d\n",addr->ipaddr,addr->pending,addr->usock,addr->addrind);
addr->pending = (uint32_t)time(NULL);
if ( (port= (uint16_t)(addr->ipbits >> 32)) == 0 )
port = coin->chain->portp2p;
@ -604,7 +604,7 @@ void iguana_startconnection(void *arg)
if ( addr->usock < 0 || coin->peers.shuttingdown != 0 )
{
strcpy(ipaddr,addr->ipaddr);
//printf("refused PEER KILLED. for %s:%d usock.%d\n",ipaddr,coin->chain->portp2p,addr->usock);
printf("refused PEER KILLED. slot.%d for %s:%d usock.%d\n",addr->addrind,ipaddr,coin->chain->portp2p,addr->usock);
iguana_iAkill(coin,addr,1);
}
else
@ -693,13 +693,18 @@ void *iguana_iAddriterator(struct iguana_info *coin,struct iguana_iAddr *iA)
//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));
if ( addr->pending == 0 && iA->status != IGUANA_PEER_CONNECTING )
{
iA->status = IGUANA_PEER_CONNECTING;
addr->pending = (uint32_t)time(NULL);
if ( iguana_rwiAddrind(coin,1,iA,iA->hh.itemind) > 0 )
{
//printf("iA.%p iguana_startconnection.(%s) status.%d pending.%d\n",iA,addr->ipaddr,iA->status,addr->pending);
iA->status = IGUANA_PEER_CONNECTING;
addr->pending = (uint32_t)time(NULL);
iguana_launch(coin,"connection",iguana_startconnection,addr,IGUANA_CONNTHREAD);
} else printf("error rwiAddrind.%d\n",iA->hh.itemind);
}
else
{
addr->ipbits = 0;
printf("error rwiAddrind.%d\n",iA->hh.itemind);
}
}
} else printf("no open peer slots left\n");
}

5
iguana/iguana_recv.c

@ -643,7 +643,7 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana
struct iguana_bundle *bp=0; int32_t bundlei = -2; struct iguana_block *block;
bp = iguana_bundleset(coin,&block,&bundlei,origblock);
char str[65];
if ( 1 && bp == coin->current )
//if ( 1 && bp == coin->current )
fprintf(stderr,"blockRECV.%d %s [%d:%d] block.%08x | h.%d\n",req->numtx,bits256_str(str,origblock->RO.hash2),bp!=0?bp->hdrsi:-1,bundlei,block->fpipbits,bp!=0?bp->numhashes:-1);
if ( bundlei == 1 && bp != 0 && bp->numhashes < bp->n )
{
@ -779,10 +779,11 @@ int32_t iguana_reqblocks(struct iguana_info *coin)
}
else if ( bp != 0 && bits256_nonz(bp->hashes[bundlei]) == 0 && time(NULL) > bp->issued[bundlei]+60 )
{
if ( bundlei < bp->n-1 && bits256_nonz(bp->hashes[bundlei+1]) != 0 )
if ( bundlei > 0 && bits256_nonz(bp->hashes[bundlei+1]) != 0 )
{
if ( (block= iguana_blockfind(coin,bp->hashes[bundlei+1])) != 0 && bits256_nonz(block->RO.prev_block) != 0 )
{
bp->hashes[bundlei] = block->RO.prev_block;
printf("reqblock [%d:%d]\n",bp->hdrsi,bundlei);
iguana_blockQ("reqblocks1",coin,bp,bundlei,bp->hashes[bundlei],0);
}

Loading…
Cancel
Save