From 8a7ebabf3bd72a13c65d379b6f58ec2f5e199e94 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 22 Oct 2017 14:02:53 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 11 ++--------- iguana/exchanges/LP_signatures.c | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index fb2a7e8f7..9ab921b91 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -54,7 +54,6 @@ int32_t LP_mypubsock = -1; int32_t LP_mypullsock = -1; int32_t LP_showwif,IAMLP = 0; double LP_profitratio = 1.; -char *LP_lastcommand; struct LP_privkey { bits256 privkey; uint8_t rmd160[20]; }; @@ -265,9 +264,6 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int free_json(recvjson); } } - if ( LP_lastcommand != 0 ) - free(LP_lastcommand); - LP_lastcommand = clonestr((char *)ptr); //double millis = OS_milliseconds(); if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,ptr,recvlen,sock)) != 0 ) free(retstr); @@ -280,9 +276,6 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int { if ( jobj(argjson,"method") != 0 && strcmp("connect",jstr(argjson,"method")) == 0 ) printf("self.(%s)\n",str); - if ( LP_lastcommand != 0 ) - free(LP_lastcommand); - LP_lastcommand = clonestr(str); if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 ) { portable_mutex_lock(&LP_commandmutex); @@ -323,7 +316,7 @@ int32_t LP_nanomsg_recvs(void *ctx) milli = OS_milliseconds(); nonz += LP_sock_check("PULL",ctx,origipaddr,LP_mypubsock,peer->subsock,peer->ipaddr,1); if ( OS_milliseconds()-milli > 100 ) - fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds: (%s)\n",OS_milliseconds()-milli,LP_lastcommand!=0?LP_lastcommand:""); + fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds\n",OS_milliseconds()-milli); } /*HASH_ITER(hh,LP_coins,coin,ctmp) // firstrefht,firstscanht,lastscanht { @@ -337,7 +330,7 @@ int32_t LP_nanomsg_recvs(void *ctx) milli = OS_milliseconds(); nonz += LP_sock_check("SUB",ctx,origipaddr,-1,LP_mypullsock,"127.0.0.1",1); if ( OS_milliseconds()-milli > 100 ) - fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds: (%s)\n",OS_milliseconds()-milli,LP_lastcommand!=0?LP_lastcommand:""); + fprintf(stderr,">>>>>>>>>>>>>>>>> BIG latency lag %.3f milliseconds\n",OS_milliseconds()-milli); } //portable_mutex_unlock(&LP_nanorecvsmutex); return(nonz); diff --git a/iguana/exchanges/LP_signatures.c b/iguana/exchanges/LP_signatures.c index 87bee3dc4..b3ff9a9c9 100644 --- a/iguana/exchanges/LP_signatures.c +++ b/iguana/exchanges/LP_signatures.c @@ -391,13 +391,13 @@ void LP_query(void *ctx,char *myipaddr,int32_t mypubsock,char *method,struct LP_ jaddbits256(reqjson,"pubkey",qp->srchash); jaddstr(reqjson,"method",method); msg = jprint(reqjson,1); - msg2 = clonestr(msg); // LP_addsig printf("QUERY.(%s)\n",msg); memset(&zero,0,sizeof(zero)); portable_mutex_lock(&LP_reservedmutex); if ( num_Reserved_msgs < sizeof(Reserved_msgs)/sizeof(*Reserved_msgs)-2 ) { + msg2 = clonestr(msg); Reserved_msgs[num_Reserved_msgs++] = msg; Reserved_msgs[num_Reserved_msgs++] = msg2; }