Browse Source

Test

etomic
jl777 8 years ago
parent
commit
b7c57d3194
  1. 2
      iguana/exchanges/LP_nativeDEX.c
  2. 10
      iguana/exchanges/LP_network.c
  3. 8
      iguana/exchanges/LP_peers.c

2
iguana/exchanges/LP_nativeDEX.c

@ -373,7 +373,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,double profit
timeout = 1;
nn_setsockopt(pullsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
timeout = 1;
maxsize = 1024 * 1024;
maxsize = 2 * 1024 * 1024;
nn_setsockopt(pullsock,NN_SOL_SOCKET,NN_RCVBUF,&maxsize,sizeof(maxsize));
}
}

10
iguana/exchanges/LP_network.c

@ -35,7 +35,7 @@ int32_t LP_send(int32_t sock,char *msg,int32_t freeflag)
return(-1);
}
len = (int32_t)strlen(msg) + 1;
for (i=0; i<1000; i++)
for (i=0; i<100; i++)
{
pfd.fd = sock;
pfd.events = NN_POLLOUT;
@ -43,7 +43,7 @@ int32_t LP_send(int32_t sock,char *msg,int32_t freeflag)
{
if ( (sentbytes= nn_send(sock,msg,len,0)) != len )
printf("LP_send sent %d instead of %d\n",sentbytes,len);
//else printf("SENT.(%s)\n",msg);
else printf("SENT.(%s)\n",msg);
if ( freeflag != 0 )
free(msg);
return(sentbytes);
@ -51,11 +51,11 @@ int32_t LP_send(int32_t sock,char *msg,int32_t freeflag)
usleep(1000);
}
printf("error LP_send, pipeline timeout\n");
if ( (sentbytes= nn_send(sock,msg,len,0)) != len )
printf("LP_send sent %d instead of %d\n",sentbytes,len);
//if ( (sentbytes= nn_send(sock,msg,len,0)) != len )
// printf("LP_send sent %d instead of %d\n",sentbytes,len);
if ( freeflag != 0 )
free(msg);
return(sentbytes);
return(-1);
}
uint32_t LP_swapsend(int32_t pairsock,struct basilisk_swap *swap,uint32_t msgbits,uint8_t *data,int32_t datalen,uint32_t nextbits,uint32_t crcs[2])

8
iguana/exchanges/LP_peers.c

@ -50,7 +50,7 @@ char *LP_peers()
struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char *ipaddr,uint16_t port,uint16_t pushport,uint16_t subport,double profitmargin,int32_t numpeers,int32_t numutxos)
{
uint32_t ipbits; int32_t pushsock,subsock,timeout; char checkip[64],pushaddr[64],subaddr[64]; struct LP_peerinfo *peer = 0;
uint32_t ipbits; int32_t maxsize,pushsock,subsock,timeout; char checkip[64],pushaddr[64],subaddr[64]; struct LP_peerinfo *peer = 0;
ipbits = (uint32_t)calc_ipbits(ipaddr);
expand_ipbits(checkip,ipbits);
if ( strcmp(checkip,ipaddr) == 0 )
@ -72,11 +72,13 @@ struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char
strcpy(peer->ipaddr,ipaddr);
if ( pushport != 0 && subport != 0 && (pushsock= nn_socket(AF_SP,NN_PUSH)) >= 0 )
{
timeout = 1000;
nn_setsockopt(pushsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
nanomsg_tcpname(pushaddr,peer->ipaddr,pushport);
if ( nn_connect(pushsock,pushaddr) >= 0 )
{
timeout = 100;
nn_setsockopt(pushsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
maxsize = 2 * 1024 * 1024;
nn_setsockopt(pushsock,NN_SOL_SOCKET,NN_SNDBUF,&maxsize,sizeof(maxsize));
printf("connected to push.(%s) %d\n",pushaddr,pushsock);
peer->connected = (uint32_t)time(NULL);
peer->pushsock = pushsock;

Loading…
Cancel
Save