jl777 7 years ago
parent
commit
0632218a7d
  1. 6
      iguana/exchanges/LP_ordermatch.c
  2. 48
      iguana/exchanges/stats.c

6
iguana/exchanges/LP_ordermatch.c

@ -468,8 +468,6 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,char *base,char *rel,double
if ( (pair= LP_nanobind(ctx,pairstr)) >= 0 )
{
swap->N.pair = pair;
//utxo->S.swap = swap;
//swap->utxo = utxo;
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_bobloop,(void *)swap) == 0 )
{
reqjson = LP_quotejson(qp);
@ -665,7 +663,7 @@ char *LP_connectedalice(struct LP_quoteinfo *qp,char *pairstr) // alice
LP_aliceid(qp->tradeid,qp->aliceid,"error10",qp->R.requestid,qp->R.quoteid);
printf("connect error %s\n",nn_strerror(nn_errno()));
}
printf("connected result.(%s)\n",jprint(retjson,0));
//printf("connected result.(%s)\n",jprint(retjson,0));
if ( jobj(retjson,"error") != 0 )
{
LP_availableset(qp->desttxid,qp->vout);
@ -935,7 +933,7 @@ struct LP_quoteinfo *LP_trades_gotreserved(void *ctx,struct LP_quoteinfo *qp,str
struct LP_quoteinfo *LP_trades_gotconnect(void *ctx,struct LP_quoteinfo *qp,struct LP_quoteinfo *newqp,char *pairstr)
{
double myprice,qprice,bid,ask; struct iguana_info *coin;
//char str[65]; printf("bob %s received CONNECT.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid);
char str[65]; printf("bob %s received CONNECT.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid);
*newqp = *qp;
qp = newqp;
if ( (coin= LP_coinfind(qp->srccoin)) == 0 )

48
iguana/exchanges/stats.c

@ -524,12 +524,12 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po
#ifdef FROM_MARKETMAKER
if ( strcmp(remoteaddr,"127.0.0.1") == 0 || LP_valid_remotemethod(argjson) > 0 )
{
buf = jprint(argjson,0);
LP_queuecommand(&retstr,buf,-1,1);
free(buf);
while ( retstr == 0 )
usleep(10000);
//if ( (retstr= stats_JSON(ctx,myipaddr,-1,argjson,remoteaddr,port)) != 0 )
//buf = jprint(argjson,0);
//LP_queuecommand(&retstr,buf,-1,1);
//free(buf);
//while ( retstr == 0 )
// usleep(10000);
if ( (retstr= stats_JSON(ctx,myipaddr,-1,argjson,remoteaddr,port)) != 0 )
{
if ( (retitem= cJSON_Parse(retstr)) != 0 )
jaddi(retarray,retitem);
@ -537,12 +537,12 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po
}
} else retstr = clonestr("{\"error\":\"invalid remote method\"}");
#else
buf = jprint(argjson,0);
LP_queuecommand(&retstr,buf,-1,1);
free(buf);
while ( retstr == 0 )
usleep(10000);
//if ( (retstr= stats_JSON(ctx,myipaddr,-1,argjson,remoteaddr,port)) != 0 )
//buf = jprint(argjson,0);
//LP_queuecommand(&retstr,buf,-1,1);
//free(buf);
//while ( retstr == 0 )
// usleep(10000);
if ( (retstr= stats_JSON(ctx,myipaddr,-1,argjson,remoteaddr,port)) != 0 )
{
if ( (retitem= cJSON_Parse(retstr)) != 0 )
jaddi(retarray,retitem);
@ -569,20 +569,20 @@ char *stats_rpcparse(char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *po
#ifdef FROM_MARKETMAKER
if ( strcmp(remoteaddr,"127.0.0.1") == 0 || LP_valid_remotemethod(arg) > 0 )
{
buf = jprint(arg,0);
LP_queuecommand(&retstr,buf,-1,1);
free(buf);
while ( retstr == 0 )
usleep(10000);
//retstr = stats_JSON(ctx,myipaddr,-1,arg,remoteaddr,port);
//buf = jprint(arg,0);
//LP_queuecommand(&retstr,buf,-1,1);
//free(buf);
//while ( retstr == 0 )
// usleep(10000);
retstr = stats_JSON(ctx,"127.0.0.1",-1,arg,remoteaddr,port);
} else retstr = clonestr("{\"error\":\"invalid remote method\"}");
#else
buf = jprint(arg,0);
LP_queuecommand(&retstr,buf,-1,1);
free(buf);
while ( retstr == 0 )
usleep(10000);
//retstr = stats_JSON(ctx,myipaddr,-1,arg,remoteaddr,port);
//buf = jprint(arg,0);
//LP_queuecommand(&retstr,buf,-1,1);
//free(buf);
//while ( retstr == 0 )
// usleep(10000);
retstr = stats_JSON(ctx,myipaddr,-1,arg,remoteaddr,port);
#endif
}
free_json(argjson);

Loading…
Cancel
Save