From 01d717e3a60fc9e45ce94a056bec1ac8476c8c02 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 7 Jul 2017 18:23:38 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 4 ++-- iguana/exchanges/LP_nativeDEX.c | 4 ++-- iguana/exchanges/LP_network.c | 21 ++++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 75769ae74..b28194033 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -291,8 +291,8 @@ trust(pubkey, trust)\n\ else if ( strcmp(method,"utxo") == 0 ) { if ( LP_utxoaddjson(1,LP_mypubsock,argjson) != 0 ) - retstr = clonestr("{\"result\":\"success\",\"notifyutxo\":\"received\"}"); - else retstr = clonestr("{\"result\":\"couldnt add utxo\"}"); + return(clonestr("{\"result\":\"success\",\"utxo\":\"received\"}")); + else return(clonestr("{\"result\":\"couldnt add utxo\"}")); } else { diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 0f61bd5d9..22617a814 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -122,7 +122,7 @@ int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32) crcs[i] = crcs[i >> 1]; crcs[i >> 1] = crc32; dup++; - printf("duplicate %08x in slot %d -> slot %d (%lu / %lu)\n",crc32,i,i>>1,dup,total); + printf("duplicate %u in slot %d -> slot %d (%lu / %lu)\n",crc32,i,i>>1,dup,total); } *duplicatep = 1; break; @@ -317,7 +317,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int void command_rpcloop(void *myipaddr) { - int32_t nonz = 0; char *origipaddr; struct iguana_info *coin,*ctmp; struct LP_peerinfo *peer,*tmp; void *ctx; + int32_t nonz = 0; char *origipaddr; struct LP_peerinfo *peer,*tmp; void *ctx; //struct iguana_info *coin,*ctmp; ctx = bitcoin_ctx(); if ( (origipaddr= myipaddr) == 0 ) origipaddr = "127.0.0.1"; diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 0f189cbcf..052b6fd0a 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -92,15 +92,18 @@ int32_t LP_Qenqueued,LP_Qdequeued; void _LP_sendqueueadd(uint32_t crc32,int32_t sock,uint8_t *msg,int32_t msglen,int32_t peerind) { struct LP_queue *ptr; - ptr = calloc(1,sizeof(*ptr) + msglen); - ptr->crc32 = crc32; - ptr->sock = sock; - ptr->peerind = peerind; - ptr->msglen = msglen; - memcpy(ptr->msg,msg,msglen); - DL_APPEND(LP_Q,ptr); - LP_Qenqueued++; - printf("Q.%p: peerind.%d msglen.%d\n",ptr,peerind,msglen); + if ( LP_Qenqueued == 0 ) + { + ptr = calloc(1,sizeof(*ptr) + msglen); + ptr->crc32 = crc32; + ptr->sock = sock; + ptr->peerind = peerind; + ptr->msglen = msglen; + memcpy(ptr->msg,msg,msglen); + DL_APPEND(LP_Q,ptr); + LP_Qenqueued++; + //printf("Q.%p: peerind.%d msglen.%d\n",ptr,peerind,msglen); + } } void queue_loop(void *ignore)