From 1dc7c0312af0be776bb478f322b997600a2c7124 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 6 Jul 2017 13:22:40 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_forwarding.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/iguana/exchanges/LP_forwarding.c b/iguana/exchanges/LP_forwarding.c index f41ae28ee..bf0033905 100644 --- a/iguana/exchanges/LP_forwarding.c +++ b/iguana/exchanges/LP_forwarding.c @@ -339,24 +339,19 @@ int32_t LP_forward(void *ctx,char *myipaddr,int32_t pubsock,double profitmargin, mlen = (int32_t)strlen(msg) + 1; HASH_ITER(hh,LP_peerinfos,peer,tmp) { - if ( bits256_cmp(pubkey,LP_mypubkey) == 0 ) - continue; - if ( bits256_nonz(pubkey) != 0 ) + if ( (retstr= issue_LP_lookup(peer->ipaddr,peer->port,pubkey)) != 0 ) { - if ( (retstr= issue_LP_lookup(peer->ipaddr,peer->port,pubkey)) != 0 ) + if ( (retjson= cJSON_Parse(retstr)) != 0 ) { - if ( (retjson= cJSON_Parse(retstr)) != 0 ) + if ( jint(retjson,"forwarding") != 0 && peer->pushsock >= 0 ) { - if ( jint(retjson,"forwarding") != 0 && peer->pushsock >= 0 ) - { - printf("found LPnode.(%s) forward.(%s)\n",peer->ipaddr,msg); - if ( LP_send(peer->pushsock,msg,mlen,0) == mlen ) - n++; - } - free_json(retjson); + printf("found LPnode.(%s) forward.(%s)\n",peer->ipaddr,msg); + if ( LP_send(peer->pushsock,msg,mlen,0) == mlen ) + n++; } - free(retstr); + free_json(retjson); } + free(retstr); } if ( n >= 8 )//sizeof(default_LPnodes)/sizeof(*default_LPnodes) ) break;