jl777 7 years ago
parent
commit
f60361c9ed
  1. 4
      iguana/exchanges/LP_nativeDEX.c
  2. 10
      iguana/exchanges/LP_network.c
  3. 9
      iguana/exchanges/LP_ordermatch.c
  4. 4
      iguana/exchanges/LP_peers.c

4
iguana/exchanges/LP_nativeDEX.c

@ -1292,8 +1292,8 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu
{
timeout = 100;
nn_setsockopt(LP_mypubsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
timeout = 10;
nn_setsockopt(LP_mypubsock,NN_SOL_SOCKET,NN_MAXTTL,&timeout,sizeof(timeout));
//timeout = 10;
//nn_setsockopt(LP_mypubsock,NN_SOL_SOCKET,NN_MAXTTL,&timeout,sizeof(timeout));
}
else
{

10
iguana/exchanges/LP_network.c

@ -657,10 +657,10 @@ char *_LP_psock_create(int32_t *pullsockp,int32_t *pubsockp,char *ipaddr,uint16_
nn_setsockopt(pullsock,NN_SOL_SOCKET,NN_RCVTIMEO,&arg,sizeof(arg));
if ( pubsock >= 0 )
nn_setsockopt(pubsock,NN_SOL_SOCKET,NN_RCVTIMEO,&arg,sizeof(arg));
arg = 2;
nn_setsockopt(pullsock,NN_SOL_SOCKET,NN_MAXTTL,&arg,sizeof(arg));
if ( pubsock >= 0 )
nn_setsockopt(pubsock,NN_SOL_SOCKET,NN_MAXTTL,&arg,sizeof(arg));
//arg = 2;
//nn_setsockopt(pullsock,NN_SOL_SOCKET,NN_MAXTTL,&arg,sizeof(arg));
//if ( pubsock >= 0 )
// nn_setsockopt(pubsock,NN_SOL_SOCKET,NN_MAXTTL,&arg,sizeof(arg));
nanomsg_transportname(0,pushaddr,ipaddr,publicport);
nanomsg_transportname(0,subaddr,ipaddr,subport);
LP_psockadd(ispaired,pullsock,publicport,pubsock,subport,subaddr,pushaddr,cmdchannel);
@ -696,7 +696,7 @@ char *_LP_psock_create(int32_t *pullsockp,int32_t *pubsockp,char *ipaddr,uint16_
*pullsockp = pullsock;
*pubsockp = pubsock;
return(jprint(retjson,1));
} else printf("bind error on %s or %s\n",pushaddr,subaddr);
} //else printf("bind error on %s or %s\n",pushaddr,subaddr);
if ( pullsock >= 0 )
nn_close(pullsock);
if ( pubsock >= 0 )

9
iguana/exchanges/LP_ordermatch.c

@ -1013,7 +1013,7 @@ void LP_tradesloop(void *ctx)
now = (uint32_t)time(NULL);
Q = qtp->Q;
funcid = qtp->funcid;
printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp->aliceid,qtp->iambob);
//printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp->aliceid,qtp->iambob);
portable_mutex_lock(&LP_tradesmutex);
DL_DELETE(LP_tradesQ,qtp);
HASH_FIND(hh,LP_trades,&qtp->aliceid,sizeof(qtp->aliceid),tp);
@ -1041,7 +1041,7 @@ printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp
{
flag = 1;
tp->negotiationdone = now;
printf("bob sets negotiationdone.%u\n",now);
//printf("bob sets negotiationdone.%u\n",now);
LP_trades_gotconnect(ctx,&tp->Q,&tp->Qs[LP_CONNECT],tp->pairstr);
}
}
@ -1054,10 +1054,7 @@ printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp
//printf("finished dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp->aliceid,qtp->iambob);
free(qtp);
if ( tp->negotiationdone != 0 )
{
printf("iambob.%d negotiationdone.%u\n",tp->iambob,tp->negotiationdone);
continue;
}
flag = 0;
if ( qtp->iambob == tp->iambob )
{
@ -1081,7 +1078,7 @@ printf("dequeue %p funcid.%d aliceid.%llu iambob.%d\n",qtp,funcid,(long long)qtp
{
flag = 1;
tp->negotiationdone = now;
printf("bob sets negotiationdone.%u\n",now);
//printf("bob sets negotiationdone.%u\n",now);
LP_trades_gotconnect(ctx,&tp->Q,&tp->Qs[LP_CONNECT],tp->pairstr);
}
}

4
iguana/exchanges/LP_peers.c

@ -167,8 +167,8 @@ struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char
// valid++;
if ( valid > 0 )
{
timeout = 10;
nn_setsockopt(pushsock,NN_SOL_SOCKET,NN_MAXTTL,&timeout,sizeof(timeout));
//timeout = 10;
//nn_setsockopt(pushsock,NN_SOL_SOCKET,NN_MAXTTL,&timeout,sizeof(timeout));
timeout = 100;
nn_setsockopt(pushsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
printf("connected to push.(%s) pushsock.%d valid.%d | ",pushaddr,pushsock,valid);

Loading…
Cancel
Save