Browse Source

Test

etomic
jl777 8 years ago
parent
commit
6f0edcf7c7
  1. 10
      iguana/exchanges/LP_ordermatch.c
  2. 6
      iguana/exchanges/LP_swap.c

10
iguana/exchanges/LP_ordermatch.c

@ -355,8 +355,8 @@ int32_t LP_nanobind(void *ctx,char *pairstr)
if ( nn_bind(pairsock,bindaddr) >= 0 ) if ( nn_bind(pairsock,bindaddr) >= 0 )
{ {
timeout = 100; timeout = 100;
//nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
//nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
printf("nanobind %s to %d\n",pairstr,pairsock); printf("nanobind %s to %d\n",pairstr,pairsock);
return(pairsock); return(pairsock);
} else printf("error binding to %s for %s\n",bindaddr,pairstr); } else printf("error binding to %s for %s\n",bindaddr,pairstr);
@ -456,9 +456,9 @@ char *LP_connectedalice(cJSON *argjson) // alice
jaddstr(retjson,"error","couldnt create pairsock"); jaddstr(retjson,"error","couldnt create pairsock");
else if ( nn_connect(pairsock,pairstr) >= 0 ) else if ( nn_connect(pairsock,pairstr) >= 0 )
{ {
//timeout = 100; timeout = 100;
//nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_SNDTIMEO,&timeout,sizeof(timeout));
//nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout)); nn_setsockopt(pairsock,NN_SOL_SOCKET,NN_RCVTIMEO,&timeout,sizeof(timeout));
LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis,Q.destcoin,Q.destsatoshis,Q.timestamp,Q.quotetime,DEXselector); LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis,Q.destcoin,Q.destsatoshis,Q.timestamp,Q.quotetime,DEXselector);
swap = LP_swapinit(0,0,Q.privkey,&Q.R,&Q); swap = LP_swapinit(0,0,Q.privkey,&Q.R,&Q);
swap->N.pair = pairsock; swap->N.pair = pairsock;

6
iguana/exchanges/LP_swap.c

@ -662,7 +662,7 @@ void LP_bobloop(void *_swap)
expiration = (uint32_t)time(NULL) + LP_SWAPSTEP_TIMEOUT; expiration = (uint32_t)time(NULL) + LP_SWAPSTEP_TIMEOUT;
if ( swap != 0 ) if ( swap != 0 )
{ {
if ( LP_waitsend("pubkeys",60,swap->N.pair,swap,data,maxlen,LP_pubkeys_verify,LP_pubkeys_data) < 0 ) if ( LP_waitsend("pubkeys",LP_SWAPSTEP_TIMEOUT*3,swap->N.pair,swap,data,maxlen,LP_pubkeys_verify,LP_pubkeys_data) < 0 )
printf("error waitsend pubkeys\n"); printf("error waitsend pubkeys\n");
else if ( LP_waitsend("choosei",LP_SWAPSTEP_TIMEOUT,swap->N.pair,swap,data,maxlen,LP_choosei_verify,LP_choosei_data) < 0 ) else if ( LP_waitsend("choosei",LP_SWAPSTEP_TIMEOUT,swap->N.pair,swap,data,maxlen,LP_choosei_verify,LP_choosei_data) < 0 )
printf("error waitsend choosei\n"); printf("error waitsend choosei\n");
@ -718,8 +718,8 @@ void LP_aliceloop(void *_swap)
if ( swap != 0 ) if ( swap != 0 )
{ {
fprintf(stderr,"start swap iamalice pair.%d\n",swap->N.pair); fprintf(stderr,"start swap iamalice pair.%d\n",swap->N.pair);
sleep(10); sleep(1);
if ( LP_sendwait("pubkeys",60,swap->N.pair,swap,data,maxlen,LP_pubkeys_verify,LP_pubkeys_data) < 0 ) if ( LP_sendwait("pubkeys",LP_SWAPSTEP_TIMEOUT*3,swap->N.pair,swap,data,maxlen,LP_pubkeys_verify,LP_pubkeys_data) < 0 )
printf("error LP_sendwait pubkeys\n"); printf("error LP_sendwait pubkeys\n");
else if ( LP_sendwait("choosei",LP_SWAPSTEP_TIMEOUT,swap->N.pair,swap,data,maxlen,LP_choosei_verify,LP_choosei_data) < 0 ) else if ( LP_sendwait("choosei",LP_SWAPSTEP_TIMEOUT,swap->N.pair,swap,data,maxlen,LP_choosei_verify,LP_choosei_data) < 0 )
printf("error LP_sendwait choosei\n"); printf("error LP_sendwait choosei\n");

Loading…
Cancel
Save