Browse Source

Test

etomic
jl777 8 years ago
parent
commit
524699a3c7
  1. 1
      iguana/exchanges/LP_forwarding.c
  2. 7
      iguana/exchanges/LP_network.c

1
iguana/exchanges/LP_forwarding.c

@ -120,6 +120,7 @@ char *LP_register(bits256 pubkey,char *ipaddr,uint16_t port)
{
nn_close(ptr->pushsock);
printf("recreate pushsock for %s\n",pushaddr);
strcpy(ptr->pushaddr,pushaddr);
if ( (ptr->pushsock= LP_pushsock_create(ptr,pushaddr)) < 0 )
return(clonestr("{\"error\":\"couldnt recreate pushsock\",\"registered\":0}"));
} else printf("no need to create identical endpoint\n");

7
iguana/exchanges/LP_network.c

@ -114,7 +114,7 @@ void LP_psockloop(void *_ptr)
if ( (sentbytes= nn_send(sendsock,buf,size,0)) > 0 )
{
ptr->lasttime = now;
printf("PSOCKS (%d %d %d) -> %d/%d bytes\n",ptr->recvsock,ptr->sendsock,sendsock,size,sentbytes);
printf("PSOCKS (%d %d %d) -> %d/%d bytes %s\n",ptr->recvsock,ptr->sendsock,sendsock,size,sentbytes,ptr->sendaddr);
} else printf("send error to %s\n",ptr->sendaddr);
if ( buf != 0 )
{
@ -156,6 +156,7 @@ void LP_psockloop(void *_ptr)
{
ptr->lasttime = now;
sendsock = ptr->sendsock;
printf("[%s]\n",(char *)buf);
break;
}
}
@ -208,14 +209,14 @@ void LP_psockloop(void *_ptr)
if ( i < Numpsocks )
{
ptr = &PSOCKS[i];
if ( (size= nn_recv(ptr->recvsock,&buf,NN_MSG,0)) > 0 )
/*if ( (size= nn_recv(ptr->recvsock,&buf,NN_MSG,0)) > 0 )
{
printf("got %d bytes for %s\n",size,ptr->sendaddr);
ptr->lasttime = now;
sendsock = ptr->sendsock;
break;
}
else if ( now > ptr->lasttime+PSOCK_IDLETIMEOUT )
else*/ if ( now > ptr->lasttime+PSOCK_IDLETIMEOUT )
{
printf("PSOCKS[%d] of %d (%u %u) lag.%d IDLETIMEOUT\n",i,Numpsocks,ptr->recvport,ptr->sendport,now - ptr->lasttime);
if ( ptr->recvsock >= 0 )

Loading…
Cancel
Save