|
@ -595,7 +595,7 @@ void iguana_startconnection(void *arg) |
|
|
printf("avoid self-loopback\n"); |
|
|
printf("avoid self-loopback\n"); |
|
|
return; |
|
|
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); |
|
|
addr->pending = (uint32_t)time(NULL); |
|
|
if ( (port= (uint16_t)(addr->ipbits >> 32)) == 0 ) |
|
|
if ( (port= (uint16_t)(addr->ipbits >> 32)) == 0 ) |
|
|
port = coin->chain->portp2p; |
|
|
port = coin->chain->portp2p; |
|
@ -604,7 +604,7 @@ void iguana_startconnection(void *arg) |
|
|
if ( addr->usock < 0 || coin->peers.shuttingdown != 0 ) |
|
|
if ( addr->usock < 0 || coin->peers.shuttingdown != 0 ) |
|
|
{ |
|
|
{ |
|
|
strcpy(ipaddr,addr->ipaddr); |
|
|
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); |
|
|
iguana_iAkill(coin,addr,1); |
|
|
} |
|
|
} |
|
|
else |
|
|
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));
|
|
|
//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 ) |
|
|
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 ) |
|
|
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);
|
|
|
//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); |
|
|
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"); |
|
|
} else printf("no open peer slots left\n"); |
|
|
} |
|
|
} |
|
|