Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
0f07dabe23
  1. 2
      crypto777/inet.c
  2. 15
      iguana/iguana_accept.c

2
crypto777/inet.c

@ -392,7 +392,7 @@ uint64_t calc_ipbits(char *ip_port)
ipbits = _calc_ipbits(ip_port);
expand_ipbits(ipaddr,ipbits);
if ( ipbits != 0 && strcmp(ipaddr,ip_port) != 0 )
printf("calc_ipbits error: (%s) -> %llx -> (%s)\n",ip_port,(long long)ipbits,ipaddr);
printf("calc_ipbits error: (%s) -> %llx -> (%s)\n",ip_port,(long long)ipbits,ipaddr), getchar();
return(ipbits);
}

15
iguana/iguana_accept.c

@ -64,7 +64,7 @@ void iguana_acceptloop(void *args)
{
struct iguana_peer *addr; struct iguana_info *coin = args;
struct pollfd pfd; int32_t sock; struct iguana_accept *ptr; uint16_t port = coin->chain->portp2p;
socklen_t clilen; struct sockaddr_in cli_addr; char ipaddr[64]; uint32_t ipbits;
socklen_t clilen; struct sockaddr_in cli_addr; char ipaddr[64]; uint32_t i,ipbits;
while ( (coin->bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 )
sleep(5);
printf("iguana_bindloop 127.0.0.1:%d bind sock.%d\n",coin->chain->portp2p,coin->bindsock);
@ -86,6 +86,19 @@ void iguana_acceptloop(void *args)
memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits));
expand_ipbits(ipaddr,ipbits);
printf("NEWSOCK.%d for %x (%s)\n",sock,ipbits,ipaddr);
for (i=0; i<IGUANA_MAXPEERS; i++)
{
if ( coin->peers.active[i].ipbits == (uint32_t)ipbits && coin->peers.active[i].usock >= 0 )
{
printf("found existing peer.(%s) in slot[%d]\n",ipaddr,i);
coin->peers.active[i].dead = (uint32_t)time(NULL);
sleep(1);
}
}
/*if ( (uint32_t)ipbits == myinfo->myaddr.myipbits )
{
}*/
if ( (addr= iguana_peerslot(coin,ipbits)) == 0 )
{
ptr = mycalloc('a',1,sizeof(*ptr));

Loading…
Cancel
Save