From 83a6006d7e5bd687f63e9b3e1521244839dac090 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 14 Nov 2017 23:58:00 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 5 +++-- iguana/exchanges/LP_ordermatch.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 98f4cc927..c5c34b353 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -315,8 +315,9 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock, } //printf("%.3f %s LP_command_process\n",OS_milliseconds()-millis,jstr(argjson,"method")); } - free_json(argjson); } + if ( argjson != 0 ) + free_json(argjson); } } //else printf("DUPLICATE.(%s)\n",(char *)ptr); portable_mutex_unlock(&LP_commandmutex); @@ -365,7 +366,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int } else validreq = 1; recvlen -= sizeof(bits256); } - if ( 0 && validreq != 0 ) + if ( validreq != 0 ) { if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,ptr,recvlen,sock)) != 0 ) free(retstr); diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a8c061359..0ab6faca0 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -799,7 +799,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, return(retval); } LP_aliceid(Q.tradeid,Q.aliceid,"reserved",0,0); - printf("alice %s received RESERVED.(%s)\n",bits256_str(str,G.LP_mypub25519),jprint(argjson,0)); + //printf("alice %s received RESERVED.(%s)\n",bits256_str(str,G.LP_mypub25519),jprint(argjson,0)); if ( (retstr= LP_quotereceived(argjson)) != 0 ) free(retstr); LP_reserved(ctx,myipaddr,pubsock,&Q); @@ -929,7 +929,9 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, printf("(%.8f %.8f) quote price %.8f too low vs %.8f for %s/%s %.8f < %.8f\n",bid,ask,qprice,price,Q.srccoin,Q.destcoin,qprice,(ask - 0.00000001) * 0.998); return(retval); } - char str[65],str2[65]; printf("(%s/v%d %s/v%d) TRADECOMMAND.(%s)\n",bits256_str(str,Q.txid),Q.vout,bits256_str(str2,Q.txid2),Q.vout2,jprint(argjson,0)); + char *astr = jprint(argjson,0); + char str[65],str2[65]; printf("(%s/v%d %s/v%d) TRADECOMMAND.(%s)\n",bits256_str(str,Q.txid),Q.vout,bits256_str(str2,Q.txid2),Q.vout2,astr); + free(astr); if ( strcmp(method,"request") == 0 ) // bob needs apayment + fee tx's { if ( LP_allocated(Q.txid,Q.vout) == 0 && LP_allocated(Q.txid2,Q.vout2) == 0 )