Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
7576b9fd8a
  1. 8
      iguana/iguana_accept.c
  2. 2
      iguana/iguana_peers.c

8
iguana/iguana_accept.c

@ -62,12 +62,18 @@ int32_t iguana_acceptspoll(uint8_t *buf,int32_t bufsize,struct iguana_accept *ac
void iguana_acceptloop(void *args)
{
int32_t bindsock,sock; struct iguana_accept *ptr; struct iguana_peer *addr; struct iguana_info *coin = args;
struct iguana_peer *addr; struct iguana_info *coin = args;
struct pollfd pfd; int32_t bindsock,sock; struct iguana_accept *ptr;
socklen_t clilen; struct sockaddr_in cli_addr; char ipaddr[64]; uint32_t ipbits;
bindsock = iguana_socket(1,"0.0.0.0",coin->chain->portp2p);
printf("iguana_bindloop 127.0.0.1:%d bind sock.%d\n",coin->chain->portp2p,bindsock);
while ( bindsock >= 0 )
{
memset(&pfd,0,sizeof(pfd));
pfd.fd = bindsock;
pfd.events = POLL_IN;
if ( poll(&pfd,1,100) <= 0 )
continue;
clilen = sizeof(cli_addr);
printf("ACCEPT (%s:%d) on sock.%d\n","127.0.0.1",coin->chain->portp2p,bindsock);
sock = accept(bindsock,(struct sockaddr *)&cli_addr,&clilen);

2
iguana/iguana_peers.c

@ -331,7 +331,7 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port)
close(sock);
return(-1);
}
if ( bindflag != 0 && listen(sock,100) != 0 )
if ( bindflag != 0 && listen(sock,3) != 0 )
{
printf("listen(%s) port.%d failed: %s sock.%d. errno.%d\n",hostname,port,strerror(errno),sock,errno);
if ( sock >= 0 )

Loading…
Cancel
Save