From aa694c6f09da14ef3b220dc6d1ad4bbbc9c980f1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 29 May 2017 19:15:28 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 1 + iguana/exchanges/LP_network.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 65a6a6ace..d9ae10154 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -38,6 +38,7 @@ struct basilisk_request *LP_requestinit(struct basilisk_request *rp,bits256 srch void LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen,double profitmargin) { char *method,*base,*rel,*retstr,*pairstr; cJSON *retjson; double price; bits256 srchash,desthash,pubkey,privkey,txid,desttxid; struct LP_utxoinfo *utxo; uint32_t timestamp,quotetime; int32_t destvout,DEXselector = 0; uint64_t txfee,satoshis,desttxfee,destsatoshis,value; struct basilisk_request R; + printf("LP_command.(%s)\n",jprint(argjson,0)); if ( (method= jstr(argjson,"method")) != 0 ) { txid = jbits256(argjson,"txid"); diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index c32ded7f4..bd6855e9d 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -115,6 +115,13 @@ char *nanomsg_tcpname(char *str,char *ipaddr,uint16_t port) int32_t LP_send(int32_t sock,char *msg,int32_t freeflag) { int32_t sentbytes,len,i; struct nn_pollfd pfd; + if ( sock < 0 ) + { + printf("LP_send to illegal socket\n"); + if ( freeflag != 0 ) + free(msg); + return(-1); + } for (i=0; i<100; i++) { pfd.fd = sock; @@ -132,6 +139,8 @@ int32_t LP_send(int32_t sock,char *msg,int32_t freeflag) usleep(1000); } printf("error LP_send\n"); + if ( freeflag != 0 ) + free(msg); return(-1); }